Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

How to set up and test the ODBC driver on Unix?

Information

 
Article Number000019712
EnvironmentProduct: Progress
Version: 9.X
Product: OpenEdge
Version: 10.x, 11.x
OS: UNIX
Question/Problem Description
How to set up and test the ODBC driver on UNIX?
How to install and configure the ODBC driver on UNIX?
How do I set up ODBC on UNIX?
How do I setup ODBC DSN on UNIX?
How to prepare for a UNIX to UNIX ODBC connection?
How do I configure ODBC on UNIX?
How to use ODBC on UNIX?
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
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 
000032523, 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 and $DLC/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 directory. 
  • 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:
name: sysprogress 
password: sysprogress. 

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 
 
[ODBC Drivers]
Progress=Installed

[Progress]
Driver=/usr1/dlc/odbc/lib/pgoe1023.so]

3.3. Create Environment Variables
  • ODBCINI that points to the odbc.ini file
  • ODBCINST that points to the odbcinst.ini file
  • Example: 
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.
  • Example: 
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: 
cd $DLC/odbc/demo
gcc -o demoodbc -I../include demoodbc.c -L../lib -lodbc -lodbcinst <-lpgicuXX>

The <-lpgicuXX> should be replaced with the name of the appropriate library.  
  • Example:  
libpgicu23 located in $DLC/odbc/lib would be -lpgicu23.
  • If there were no errors, a demoodbc executable will be created in the same directory. 
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.
Workaround
Notes
For older OpenEdge 10.x, use pgoe1023.so and for the gcc compiler execution, make use of -lpgicu23.
For OpenEdge 10.2B07, the driver is pgoe1025.so, and the gcc compiler execution should make use of -lpgicu25.
 
The ODBC API is standardized and there are a number of ODBC frameworks available on UNIX which allow to mix ODBC drivers from different vendors. Progress provides both a specific ODBC driver for the Progress and OpenEdge databases, and an ODBC framework to use this driver. It may be possible to use the ODBC driver within a third-party framework - although this has not been specifically tested by Progress.
 
Path names should be written in full. Environment variables cannot be used in the odbc.ini!
 
OS-Specific steps for compilation:
 
AIX:
 
32-bit: syntax:
 
xlC_r -o demoodbc -I../include demoodbc.c -L../lib -lc_r -lC_r -lodbc
 
64-bit: syntax:
 
xlC_r -DODBC64 -q64 -qlonglong -qlongdouble -qvftable -o demoodbc -I../include demoodbc.c -L../lib -lc_r -lC_r -lodbc
 
HP-UX: syntax when linking library files:
            
aCC -o demoodbc -I../include demoodbc.c -L../lib -lodbc -lodbcinst -lpgicuXX

Please refer to HP documentation for a complete explanation: http://docs.hp.com/en/8/commandsyntax.htm

Compiling 32-bit OpenEdge files under 64-bit Linux
The following packages may be needed:  glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 ncurses-devel.i686

To install these (the following option will likely be needed to override yum install because the current environment is 64-bit.


 --setopt=protected_multilib=false 

Example of the yum command to install the above files:

 
sudo yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 ncurses-devel.i686  --setopt=protected_multilib=false

After that is done the -m32 switch must be added to the gcc compile statement.
Example: 

gcc -o demoodbc -I../include demoodbc.c -L../lib -lodbc -lodbcinst -lpgicuXX -m32
Last Modified Date11/21/2018 2:40 PM