General steps needed to use the ODBC driver on UNIX:
1. Ensure that the database is started with Networking enabled (-S portnumber, no -H is needed since OpenEdge 10.1x)
2. Ensure the Progress/OpenEdge ODBC driver is installed
3. Configure and Test a Data Source
4. Compile / run the program
For the purposes of this demonstration:
- The ODBC driver connects to the bundled sports2000 test database.
- It is assumed that this database is already available in the WORK directory for use. (prodb test sports2000)
- Create an empty $DLC/odbc/demo directory.
- The unixODBCTest.zip file attached to this Article contains:
- An odbc.ini file (tested against OpenEdge 10.2B07),
- An older odbc.ini file that worked with earlier releases that had the older driver,
- A sample odbcinst.ini
- Code that can be used to test the ODBC driver, demoodbc.c
To setup and test the ODBC driver:
1. A test database needs to be started with available Network Ports
proserve sports2000 -S <port> -n 10 -Mn 4 -Mi 1 -Ma 2 -minport 5000 -maxport 5005
2. The ODBC driver to use for the Data Source
The ODBC driver is in the $DLC/odbc/lib Progress Installation directory and is named as follows:
- pgpro9XX.so - Progress 9 driver
- pgoe10xx.so - OpenEdge 10 driver
- pgoexx.so - OpenEdge 11 driver
The ODBC driver version can change with a new Service Pack. Look in the current $DLC/odbc/lib
directory or Refer to Article ODBC driver versions shipped with various OpenEdge versions
For OpenEdge 10.2B07 or 32-bit OpenEdge running under 64-bit Linux
, refer the Notes Section
below for additional information.
The ODBC Drivers depend on other libraries in $DLC/odbc/lib
; programs using this driver need to be able to find shared libraries in these locations.
3. In the UNIX environment, there is no standard ODBC Administration utility. To configure a Data Source, the System Information file needs to be created using any text editor to define Data Source entries. This is a plain text file that is usually called odbc.ini
3.1. Create an odbc.ini
file in the $DLC/odbc
- A several sample odbc.ini files are included in the unixODBCTest.zip file attached to the Article.
- These sample odbc.ini files relate to versions of Progress OpenEdge. The newer the version of Progress OpenEdge the greater the number of configurable parameters.
- Replace the settings as needed for the environment. Use the help comments inside the sample odbc.ini file for further information on the parameters and their values.
- In this test file, the "sysprogress" account is used with password "sysprogress". It is a special account with DBA privileges, which must first be activated:
Access the Data Administration utility:
mpro <db> -p _admin.p
Through the Data Administration Security Menu add a user:
3.2. Create a odbcinst.ini file in the $DLC/odbc directory.
- A sample odbcinst.ini file is included the unixODBCTest.zip file attached to the Article.
- Example: odbcinst.ini using the OpenEdge version 10.1C03 ODBC driver
3.3. Create Environment Variables
- ODBCINI that points to the odbc.ini file
- ODBCINST that points to the odbcinst.ini file
ODBCINI=$DLC/odbc/odbc.ini; export ODBCINI
ODBCINST=$DLC/odbc/odbcinst.ini; export ODBCINST
3.4. Set the Shared Library Path
- The Shared Library Path enables the ODBC application to locate the ODBC core components and drivers at runtime.
- Environment Variables:
LD_LIBRARY_PATH on Solaris and Linux,
SHLIB_PATH on HP/UX,
LIBPATH on AIX.
- Add the directories $DLC/odbc/lib and $DLC/lib directory to the shared library search path.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DLC/lib:$DLC/odbc/lib; export LD_LIBRARY_PATH
4. Compile and Run the Code.
4.1. Ensure the directory $DLC/odbc/demo is empty and accessible.
4.2. Copy the demoodbc.c file (included the unixODBCTest.zip file attached to the Article) into the $DLC/odbc/demo directory.
4.3. Compile the Code
- Execute the following command from within the demo directory:
gcc -o demoodbc -I../include demoodbc.c -L../lib -lodbc -lodbcinst <-lpgicuXX>
The <-lpgicuXX> should be replaced with the name of the appropriate library.
libpgicu23 located in $DLC/odbc/lib would be -lpgicu23.
- If there were no errors, a demoodbc executable will be created in the same directory.
use the following example command to compile:
gcc -maix64 -o demoodbc -I$DLC/odbc/include demoodbc.c -L$DLC/odbc/lib -lodbc -lodbcinst -lpgicu27 -Xlinker -bnoquiet
4.4. Run the demoodbc code
- The demoodbc program was written for Progress sports or sports2000 database, sysprogress must be a valid user in the database.
./demoodbc -uid sysprogress -pwd sysprogress mytest
- The program should run without errors and demonstrates that the ODBC driver is in use and accessing the database. A result set will be displayed, unless there was an error.
Note: There is a secondary sample C program in the doc as well https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dmsdv%2Ftesting-your-odbc-connection-on-unix.html%23
In addition some OE versions ship with sample C programs under $DLC/odbc/samples/
4.5. Errors and their resolution:
A Segmentation Fault message
This is usually indicative of an invalid odbc.ini or odbcinst.ini files.
Review the files for correct locations of driver files and the drivers used.
Contact Progress Technical Support with supporting evidence.