How to setup a 64 bit ODBC connection to make a connection with PHP to a 10.2B db?

rweller

New Member
I have followed the instructions in the article How to setup a 64 bit ODBC connection on CentOS 5 to make a connection with PHP to a 32 bit (or 64 bit if available) 11.0, 10.2B, 10.2A, 10.1C, 10.1B or 10.1A database (article 000027930).

I am able to create a connection using "isql -v read_v7demo sysprogress sysprogress" to the database, so it would seem the odbc.ini is setup correctly and the driver is working. However, it does not connect thru php. When it gets to line 4 in the code, where I am setting the ODBCINI var, it causes the page to crash (error is server has reset connection). If I comment out the driver in the odbc.ini file, I get the expected error saying driver is not found. It almost seems as though the driver causes the page to crash. Any ideas or suggestions would be greatly appreciated.

<?php
putenv("DLC=/u/progress/clientaccess");
putenv("ODBCDIR=/u/progress/clientaccess/odbc");
putenv("LD_LIBRARY_PATH=/u/progress/clientaccess/odbc/lib:/u/progress/clientaccess/lib");
putenv("ODBCINI=/etc/odbc.ini");
echo "hello<br>";
$conn=odbc_connect("read_v7demo","sysprogress","sysprogress", SQL_CUR_USE_ODBC);
if ($conn) {
echo "awesome<br>";
} else {
echo "try again " . odbc_error(). " " . odbc_errormsg();
}
?>

/etc/odbc.ini
[ODBC Data Sources]
Progress=Progress_SQL92_Driver

[read_v7demo]
Driver=/u/progress/clientaccess/odbc/lib/pgoe1025.so
DatabaseName=v7demo
PortNumber=8004
HostName=a3400
;LogonID=sysprogress
;Password=sysprogress
;APILevel=1
;ConnectFunctions=YYN
;CPTimeout=60
;DriverODBCVer=03.60
;FileUsage=0
;SQLLevel=0
;UsageCount=1
;ArraySize=50
;DefaultLongDataBuffLen=2048
DefaultIsolationLevel=REPEATABLE UNCOMMITTED
;StaticCursorLongColBuffLen=4096
:TRACE=1
:TRACEFILE=/tmp/odbctrace.out
[ODBC]
InstallDir=/u/progress/clientaccess/odbc
Trace=1
TraceFile=/tmp/odbctrace.out
TraceDll=/u/progress/clientaccess/odbc/lib/pgtrc25.so
UseCursorLib=0

Here is the article:
How to setup a 64 bit ODBC connection on CentOS 5 to make a connection with PHP to a 32 bit (or 64 bit if available) 11.0, 10.2B, 10.2A, 10.1C, 10.1B or 10.1A database.
Environment
Linux CentOS 5 64 bit
Question/Problem Description
Display data from a 32 bit (or 64 bit if available for that version of the database) 11.0, 10.2B, 10.2A, 10.1C, 10.1B or 10.1A database on the 64 bit CentOS 5 webserver.
Clarifying Information
A 64 bit ODBC driver is only available for Linux from version 11.0, previous ODBC drivers provided with the Linux setup files only allowed 32 bit ODBC connections.
Error Message
Defect/Enhancement Number
Cause
A 64 bit ODBC driver is only available for Linux from version 11.0, previous ODBC drivers provided with the Linux setup files only allowed 32 bit ODBC connections.
Resolution
To create a working 64 bit ODBC connection on a newly installed 64 bit CentOS 5.6 virtual machine (with disabled firewall and SELinux), and using that ODBC connection on a PHP webpage, follow the following steps:

- install a 64 bit java 6 JDK from oracle, for example jdk-6u30-linux-x64.bin for the 64 bit OpenEdge SQL Client Access 11.0

- install the Linux 64 bit OpenEdge® SQL Client Access 11.0 (PROGRESS_OE_11.0_LNX_64_SQLCLIENTACCESS.tar.gz), when prompted to copy some executable in your path do not do so.

- create an OpenEdge test database using the commands ‘/usr/32or64bit/databaseVersion/dlc/bin/proenv’ followed by ‘prodb testdb demo’ and start the database with ‘proserve testdb –S 5555’

- create an user in the data administration tool with the command 'mpro testdb' and then go to 'Tools' -> 'Data Dictionary' -> 'Admin' -> 'Security' -> 'Edit User List...' -> 'Add', and add a user called 'sysprogress' (‘sysprogress’ is an administrator account that have access to all tables, in a production database another user will need to be created and access rights will need to be granted to him)

- make sure the 64 bit unixODBC is installed on the machine by doing (as root) a 'yum install unixODBC.x86_64'

- Run the commands:
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/libodbcinst.so /usr/lib64/libodbcinst.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/libpgicu25.so /usr/lib64/libpgicu25.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/libpgmback.so /usr/lib64/libpgmback.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/libpgssl25.so /usr/lib64/libpgssl25.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/odbccurs.so /usr/lib64/odbccurs.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/pgoe1025.so /usr/lib64/pgoe1025.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/pgtrc25.so /usr/lib64/pgtrc25.so
cp /usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/vscnctdlg.so /usr/lib64/vscnctdlg.so
(make sure not to copy libodbc.so to /usr/lib64/ otherwise the CentOS 5 Apache webserver will crash soon after startup)

- edit the file /etc/odbc.ini:

[ODBC Data Sources]
Progress=Progress_SQL92_Driver

[Progress]
Driver=/usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/pgoe1025.so
DatabaseName=testdb
PortNumber=5555
HostName=localhost
LogonID=sysprogress
Password=sysprogress
;APILevel=1
;ConnectFunctions=YYN
;CPTimeout=60
;DriverODBCVer=03.60
;FileUsage=0
;SQLLevel=0
;UsageCount=1
;ArraySize=50
;DefaultLongDataBuffLen=2048
;DefaultIsolationLevel=REPEATABLE READ
;StaticCursorLongColBuffLen=4096
;TRACE=1
;TRACEFILE=/tmp/odbctrace.out

[ODBC]
InstallDir=/usr/64bit/oe11sqlClientAccess/dlc/odbc
Trace=1
TraceFile=/tmp/odbctrace.out
TraceDll=/usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/pgtrc25.so
UseCursorLib=0

- and edit the file /etc/odbcinst.ini to be like this:

[ODBC Drivers]
Description = Progress driver
[Progress OpenEdge 11 Driver]
Driver=/usr/64bit/oe11sqlClientAccess/dlc/odbc/lib/pgoe1025.so
FileUsage = 1

- create a file /var/www/html/db.php containing:

< ?PHP
$dsn = "Progress";
putenv("LD_LIBRARY_PATH=/usr/64bit/oe11sqlClientAccess/dlc/odbc/lib:/usr/64bit/oe11sqlClientAccess/dlc/lib");
putenv("ODBCINI=/etc/odbc.ini");
Print "Test ODBC Progress <br>";
if ($conn_id=odbc_connect("Progress","sysprogress","sysprogress", SQL_CUR_USE_ODBC)){
echo "connected to DSN: $dsn <br>";
echo " closing connection $conn_id";
odbc_close($conn_id);
}else{
echo " can not connect to DSN: $dsn ";
}
/* phpinfo(); */
?>

- a working ODBC connection should now be seen under http://localhost/db.php and give an output like this:

Test ODBC Progress
connected to DSN: Progress
closing connection Resource id #2

- set ‘display_errors = on’ in your php.ini configuration file if you need to troubleshoot why the ODBC connection is not working.
Notes
References to Written Documentation:

OpenEdge documentation:
Progress ODBC Driver Guide
http://documentation.progress.com/output/OpenEdge110/pdfs/dmsdv/dmsdv.pdf page 59 a 65 Configuring ODBC on UNIX and Linux clients
Progress Solutions:
P21252, How to set up and test the ODBC driver on Unix?
21017, Two Sample PHP Programs to Access a Progress DB through ODBC
P20467, How to know if ODBC is installed in an Unix Environment?
P191281, How to create an OpenEdge ODBC connection under CentOS 5.6?
Attachment
Disclaimer
The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.
 
Top