Kbase P158339: PHP connection to a database using DSN is failing with Server rejects connection error.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  1/8/2010 |
|
Status: Unverified
SYMPTOM(s):
PHP connection to a database using DSN is failing with Server rejects connection error.
Warning: odbc_connect() [function.odbc-connect]: SQL error: [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Server rejects connection on attach., SQL state S1000 in SQLConnect in c:\phpcode.php on line 5
Count not connect.
Sample PHP code being used to connect to the database:
<html>
<body>
<?php
echo "insert test ";
$connect = odbc_connect("odbcDSNnamehere", "sysprogress", "x");
if (!$connect)
{
die('Could not connect: ' . mysql_error());
}
odbc_close($connect);
?>
</html>
Cannot connect to the database via ODBC using the DSN via Microsoft Excel.
FACT(s) (Environment):
Can connect to the database using SQL Explorer (sqlexp)
ODBC Test Connect is successful.
Same PHP code works when connecting to another database when you change the DSN to one specific for the other database.
UNIX
OpenEdge 10.1C
CAUSE:
The ODBC DSN being used by the ODBC client (Excel and PHP) has a space after the name of the database. The space at the end of the database name is being seen by these applications when making use of the DSN and is causing the database name to be misinterpreted.
FIX:
Remove the space that is following the name of the database within the DSN being used. Apply changes and then select OK. Now Microsoft Excel and PHP code will work as expected.
You can access the DSN via the ODBC Data Sources Administrator utility:
Start -> Settings -> Control Panel -> Administrative Tools -> Data Sources (ODBC) -> System DSN