Database Drivers in DataFlex 2021

DataFlex 2021 widens the type of applications that can be created and the format of data that can be accessed. Applications now can be either 32 bits or 64 bits and they can access SQL databases either set to store ANSI or Unicode data. Those are new combinations in a DataFlex environment, and it is important that you understand what you need in order to successfully use the environment for the application you want to build. 

Applications in 32 or 64-Bit

As a rule, 32-bit applications can only load 32-bit DLLs and 64-bit applications can only load 64-bit DLLs. With DataFlex 2021, you may create both 32- and 64-bit applications. For that reason, the Studio includes both sets of DLLs – it installs both 32- and 64-bit versions of the DataFlex SQL Driver DLLs: 32-bit DLLs are installed in \Bin and 64-bit DLLs are installed in \Bin64. Following the general rule, your 32-bit application will look to load and use the 32-bit DLLs and your 64-bit applications will look to load and use the 64-bit DLLs. When those DLLs are loaded, they will load all their dependencies respecting the 32-bit/64-bit general rule.

DataFlex Studio

The DataFlex Studio is a 64-bit application and, as any 64-bit application, can only load and use 64-bit DLLs. When using the Studio to develop applications that access SQL databases, the DataFlex SQL Driver DLLs that the Studio loads and uses are the 64-bit versions. In turn, those 64-bit DLLs will need to load and use the 64-bit version of the database client DLLs.

So, even if you are creating 32-bit applications in DataFlex 2021, if you use the Studio to build those applications, you will automatically need both the 32- and 64-bit versions of the DataFlex SQL Driver DLL as well as both the 32- and 64-bit versions of the database client DLL.

If you experience an error like

“Can’t load dll [driver_dll_name]”

when running the Studio, make sure you have the 64-bit versions of the DataFlex SQL Driver and database clients DLLs installed and available for the Studio.

ANSI and Unicode

SQL databases can store data in ANSI or Unicode format. We recommend that new databases be created as Unicode and you use the Unicode database client driver to access the database from your DataFlex application.

If you are accessing an existing database, the database itself will determine the type of character encoding it uses – ANSI or Unicode – and the database client driver should follow suit.

Some database client drivers, like MariaDB, need to be configured to match the database encoding (see How to set up and use MariaDB for more details). Other databases, like MySQL and PostgreSQL, will have specific database client driver DLLs for each character encoding (e.g. PSQLODBC30A.dll for ANSI; PSQLODBC35W.dll for Unicode). Others yet, like Oracle and SQL Server, will have a single database client driver.

Installing the Correct Database Client Driver

To summarize, you may write two different types of application: 32 and 64-bit. Each type may access data in databases storing data in ANSI or Unicode format.

In order to successfully run your application, you will need to have the correct DataFlex SQL Driver and database client DLLs in place. For example, if you are using PostgreSQL, you will need the following files in place to be able to load the application and access the data properly:

Application Type

DataFlex SQL Driver

ANSI Database

Unicode Database

32-bit

ODBC driver - odbc_drv.dll (32-bit)

PostgreSQL ANSI -PSQLODBC30A.dll

PostgreSQL Unicode – PSQLODBC35W.dll

64-bit

ODBC driver - odbc_drv.dll (64-bit)

PostgreSQL ANSI (x64) - PSQLODBC30A.dll

PostgreSQL Unicode (x64) – PSQLODBC35W.dll

 

Remember that you will always need the 64-bit version of the DLLs to use the Studio to open and run your application.

 

See Also

DataFlex SQL Drivers