unable to connect multiple open edge databases in php linux

Posted by Ezaz War on 16-Nov-2015 02:39

What i was doing in windows to connect to a database in php was to supply a string to odbc_connect

$conn_string = "Driver={Progress OpenEdge 11.3 driver}; 
HostName=" . @$hostname . "; 
PortNumber=". @$portnumber ."; 
DatabaseName=" . @$databaseName . "; 
DefaultIsolationLevel=READ COMMITTED;";

where i was able to connect to different database's changing the database variable name and other parameters in dsn string 

but in linux at last i was able to configure odbc driver but i am only able to connect to one database which is there in my odbc.ini and i am not able to dynamically build a string to connect to different databases can anyone have any idea how i can accomplish this  

- See more at: community.progress.com/.../21400

All Replies

Posted by Brian Derwart on 17-Nov-2015 16:04

As long as you have the ODBCINST environment variable defined and set to the odbcinst.ini file where the OpenEdge ODBC driver is defined, I would expect a dsn-less connection string like the one you detail above to work from a Linux client. Do you have the ODBCINST enviroment variable set?

Even if you were using a pre-defined data source from the odbc.ini file with a connection string set to DSN=yourOEdsn;etc, I would also expect that setting databaseName in this same connection string would override the databaseName value that was set in the odbc.ini file. If this is not happening then I would consider that a bug in the driver.

Can you test these scenarios and let us know what you find?

Thanks,

Brian

Posted by Ezaz War on 18-Nov-2015 08:50

yes i do have odbc inst variable set and the contents i will specify below

odbc.ini

[ODBC Data Sources]

Progress=Progress_SQL92_Driver

[Progress]

Driver=/usr/dlc/odbc/lib/pgoe27.so

HostName=mytest

DatabaseName=testdb

PortNumber=5555

QEWSD=2457141

[ODBC]

InstallDir=/usr/dlc/odbc

Trace=1

TraceFile=/tmp/odbctrace.out

TraceDll=/usr/dlc/odbc/lib/pgtrc27.so

UseCursorLib=0

odbcinst.ini

[ODBC]

Trace = no

TraceFile = /tmp/odbctrace.out

TraceDll=/usr/dlc/odbc/lib/pgtrc27.so

[ODBC Drivers]

Description = Progress driver

[Progress OpenEdge 11 Driver]

Driver=/usr/dlc/odbc/lib/pgoe27.so

FileUsage = 1

and php script is

$dsn = "Progress";

putenv("ODBCINI=/etc/odbc.ini");

putenv("ODBCINST=/etc/odbcinst.ini");

Print "Test ODBC Progress <br>";

$sql="SELECT * FROM PUB.Customer";

$hostname ="mytest";

$portnumber =5555;

$databaseName ="testdb";

$conn_string = "Driver={Progress OpenEdge 11 Driver};

   HostName=" .@ $hostname . ";

   PortNumber=".@ $portnumber .";

   DatabaseName=" .@ $databaseName . ";

   DefaultIsolationLevel=READ COMMITTED;";

if ($conn_id=odbc_connect($conn_string,"sysprogress","sysprogress")){

echo "connected to DSN: $dsn <br>";

if($result=odbc_do($conn_id, $sql)) {

echo "executing '$sql'";

echo " Results: ";

odbc_result_all($result, "BGCOLOR='#AAFFAA' border=3 width=30% bordercolordark='#FF0000'");

echo "freeing result";

odbc_free_result($result);

}else{

echo "cannot execute '$sql' ";

}

echo " closing connection $conn_id";

odbc_close($conn_id);

}else{

echo " cannot connect to DSN: $dsn ";

}

/* phpinfo(); */

?>

following error is generated if i use the odbcinst's  Progress OpenEdge 11 Driver

SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/html/dbcheck.php on line 15 cannot connect to DSN: Progress

can u help me with this

This thread is closed