Solved Sqlbase 11.7 ODBC PHP - Cannot connect error

Report SqlBase bugs and possible workarounds.
tfahey
United States of America
Posts: 101
Joined: 30 Mar 2017, 21:57
Location: La Crosse Wisconsin USA

Sqlbase 11.7 ODBC PHP - Cannot connect error

Post by tfahey » 13 Jul 2015, 22:51

Hi All,
We have had great success using the new set of drivers for 11.7. But we have run up against a problem. We cannot get a connection from a PHP program to a database. We always get this error:
PHP Warning: odbc_connect(): SQL error: [Gupta][ODBC Driver][SQLBase]00401 DBA COD Cannot open database, SQL state 08001 in SQLConnect in C:\Inetpub\vhosts\habwork.com\habclient\index.php on line 51
With Line 51 being the call to ODBC.
<<
$handle=odbc_connect ("$DSN", "$uid", "$passwd");
>>

The program is the Gupta Test ODBC program given in the 'Connecting Guide'. Here are some interesting facts:
1) If we do a 'Test Connect' from the ODBC Administrator (odbcad32) we DO get a successful test.
-> This works for both 32-bit and 64-bit System DSN's.

2) The PHP program is running under 'Google Chrome 64'. It seems to me that it prefers the 32-bit driver - I'm not sure why. (if anyone wants to tell me why - it would be most appreciated.)

3) The actual Database server and test database is on a different server, one that is NOT part of our network.
-> This server/database are perfectly connectable from a TD Mobile application on this same server. (using a .NET Connection String) The firewall is modified to accept the connection from the testing server hosting the PHP program. This is a reliable connection!

4) The Client portion of the SQL.INI looks like this:
<<
[win32client]
clientname=GoDaddy

[win32client.dll]
comdll=sqlws32

[win32client.ws32]
serverpath=serv117,71.xx.x.xx,2155/hbtest
>>
5) The server is a Windows Server 2008 R2 64-bit.

Any ideas of what is going on?

Thanks,
Tom Fahey
HAB Inc

Mike Vandine

Sqlbase 11.7 ODBC PHP - Cannot connect error

Post by Mike Vandine » 16 Jul 2015, 09:58

Hi Tom,

I've seen that an 8001 error is normally caused by there not being a 'clientruntimedir=' in the client sql.ini file pointing to the SQLBase runtime client directory.

Can you please check that?

Can you also check the DLLs that are being loaded from that directory when you try to run the PHP app? Use something like Process Explorer to do this.

Best regards,

tfahey
United States of America
Posts: 101
Joined: 30 Mar 2017, 21:57
Location: La Crosse Wisconsin USA

Sqlbase 11.7 ODBC PHP - Cannot connect error

Post by tfahey » 27 Jul 2015, 16:26

Well it turns out that the answer was simple: Change the call to ODBC_Connect to use the actual driver name, not the DSN name. So in our case that's this:

odbc_connect("Driver=Gupta SQLBase 11.7;Server=XX.82.31.XX;Database=hbtest;port=2155;isolation=RL;ClientName=mobile;SSL=negotiate", "sysadm", "xxxxxxx");

Note that the name "Gupta SQLBase 11.7" comes from the 32-bit ODBC driver name as seen in C:\Windows\Syswow64\odbcad32.exe.

So with that done we can now write PHP programs that pull data from our individual clients' databases and display them on Mobile devices. Clients love it! :D

Tom

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 0 guests