Page 1 of 1

Retrieve info on DBMS

Posted: Tue 07 Apr 2015 07:38
by brace
In SDAX 7 TOLEDBConnetion does not exist anymore. I do not know how to port to SDAC 7 this code (that was working on SDAC 6.1.6):

Code: Select all

procedure GetDbsInfo(DbConn: TMSConnection);
var
  OLEDBConnection: TOLEDBConnection;
begin
  if dbConn.Connected then
  begin
    OLEDBConnection := _TMSConn(DbConn).FIConnection as TOLEDBConnection;
    FDbms := OLEDBConnection.DBMSName + ': ' + OLEDBConnection.DBMSVer;
    FDbProvider := OLEDBConnection.ProviderFriendlyName + ': ' + OLEDBConnection.ProviderVer;
  end;
end;
THe idea od this is to write into 2 strings the NAME and Version of the RDBMS + the version, this is an example of the data:

FDBMs = "Microsoft SQL Server: 10.50.1600"
FDbPRovider = "Microsot SQL Server Native Cliente 10.0: 10.50.1617.0"

Now in sdac 7 native client is not necessary, morever since i use SQL Server only i could hardcode "MS SQL Server". SO if i am not wrong all i need is to retrieve the Sql server version, client side i could mention SDAC version.

Please suggest.

Re: Retrieve info on DBMS

Posted: Wed 08 Apr 2015 13:04
by azyk
In SDAC 7.0.2, the TOLEDBConnection class is renamed to TMSConnection. The code you have provided should be modified as follows:

Code: Select all

procedure GetDbsInfo(DbConn: TMSConnection);
var
  OLEDBConnection: TMSSQLConnection;
begin
  if dbConn.Connected then
  begin
    OLEDBConnection := TMSSQLConnection(TDBAccessUtils.GetIConnection(DbConn));
    FDbms := OLEDBConnection.GetServerVersionFull;
    FDbProvider := OLEDBConnection.GetClientVersionFull + ': ' + OLEDBConnection.GetClientVersion;
  end;
end;
To use the TMSSQLConnection class, you have to add the MSClasses unit to the uses clause. SDAC version is stored in the SDACVersion constant.

Re: Retrieve info on DBMS

Posted: Wed 08 Apr 2015 13:49
by brace
Thanks a lot for the solution provided!

Re: Retrieve info on DBMS

Posted: Fri 10 Apr 2015 13:35
by Dimon
If any other questions come up, please contact us.