Jump to content
Sign in to follow this  
Die Holländer

Which ODBC driver version is used by FireDac

Recommended Posts

Sometimes my users get an SQL error maybe because the computer doesn't have the proper

ODBC driver version installed. (Like "ODBC Driver 17 for SQL server")

 

How in runTime can I ask FireDac to fetch this driver version used by the application?

I have the FDConnection open.

 

Share this post


Link to post

I can't get the name like "ODBC Driver 17 for SQL server" but I see things like "17" by the statement under, so that will do..

 

Uses FireDAC.Phys.ODBCWrapper;

SQLDriverName:=TODBCConnection(DatabaseConnectionObject.ADConnection.CliObj).DRIVER_NAME;//DRIVER_VER;// DRIVER_ODBC_VER;

Share this post


Link to post
32 minutes ago, Lajos Juhász said:

TFDPhysMSSQLDriverLink has an ODBCDriver property, I have no server to test it.

The problem is to get this TFDPhysMSSQLDriverLink casting based on FDConnection.

Share this post


Link to post

Use the TFDConnection object's GetInfoReport() method, it takes a string list.  It shows everything you want to know about the connection and the driver it used/picked.  We have this on our login/splash screen hidden behind a TLabel double-click event because we were having the same types of issues.  Also look into the FDDrivers.ini file configuration.

 

================================
Connection definition parameters
================================
DriverID=MSSQL
Database=*******
User_Name=*******
Password=*****
ODBCAdvanced=TrustServerCertificate=Yes;
MARS=Yes
Server=192.168.56.109
VariantFormat=String
ExtendedMetaData=True
================================
FireDAC info
================================
Tool = RAD Studio 12
FireDAC = 29.0.51961.7529
Platform = Windows 32 bit
Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR
================================
Client info
================================
Loading driver MSSQL ...
  Loading odbc32.dll driver manager
  Creating ODBC environment handle
  Searching for ODBC driver ...
    Checking for ODBC driver [ODBC DRIVER 18 FOR SQL SERVER] ...
      Found [ODBC Driver 18 for SQL Server]
Driver Manager version = 03.81.19041.0000
================================
Session info
================================
Checking session ...
  Warning: The client [18.3.3.0.0] and server [16.0.0.0.0] major versions difference > 1.
  Warning: MS ODBC 11 does not support SQL_VARIANT data type.
  Warning: SQL Server 2016 and compatibility level >= 130 may lead to DATETIME comparision failure.
Current catalog = 
Current schema = dbo
Driver name = msodbcsql18.dll
Driver version = 18.03.0003
Driver conformance = 3
DBMS name = Microsoft SQL Server
DBMS version = 16.00.1130

 

  • Like 2

Share this post


Link to post

Just in case you want a list of the available ODBC drivers, you can do something simple like dropping a TFDPhysODBCDriverLink component on your TDataModule and call TFDPhysODBCDriverLink.GetDrivers,

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×