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 can now be either 32-bit or 64-bit and can access SQL databases set to store either ANSI or Unicode data. Understanding these combinations in a DataFlex environment is crucial for successfully building your application.
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-bit and 64-bit applications. The Studio includes both sets of DLLs:
- 32-bit DLLs are installed in
\Bin - 64-bit DLLs are installed in
\Bin64
Following the general rule, your 32-bit application will load and use the 32-bit DLLs, while your 64-bit applications will load and use the 64-bit DLLs. When those DLLs are loaded, they will also load all their dependencies, respecting the 32-bit/64-bit rule.
DataFlex Studio
The DataFlex Studio is a 64-bit application and, as such, 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. Consequently, these 64-bit DLLs will need to load and use the 64-bit version of the database client DLLs.
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-bit and 64-bit versions of the DataFlex SQL Driver DLL, as well as both the 32-bit 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, ensure that you have the 64-bit versions of the DataFlex SQL Driver and database client 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 that 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, 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 applications: 32-bit and 64-bit. Each type may access data in databases storing data in ANSI or Unicode format.
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 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.