I want to access to a SQL Anywhere database which is on another server. I can do it easily from Windows, but I need to do it from Debian now. All of this in php.
Windows side : I have installed SQL anywhere driver from https://archive.sap.com/documents/docs/DOC-35857, and connect with odbc:Driver={SQL Anywhere 16};Server=serveur-02;Port=2638;Database=excalib;Uid=username;Pwd=pwd; Ok, it works.
Debian side : I am on Debian 9 with php 7.0. UnixODBC is already installed and works with some others connections. FreeTDS is installed too. So I have make a link in odbcinst.ini :
[SQLAnywhere16]
Description = SQLAnywhere driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
And in odbc.ini :
[Excalibur]
Description = Excalibur
Driver = SQLAnywhere16
Server = [ip]
Port = 2638
Name = excalib
User = user
Password = password
With command
isql -v Excalibur
I got
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08004][unixODBC][FreeTDS][SQL Server]Erreur SQL Anywhere -83 : La base de
donn▒es sp▒cifi▒e est introuvable
[ISQL]ERROR: Could not SQLConnect
As I understand, it reaches server, but don't find my database. Ok, it's encouraging. Maybe a typo mistake, but I can't find documentation which can tell me, maybe someone has a hint ?
Next step is to do it with php.
odbc:Driver={SQLAnywhere16};Server=[ip];Port=2638;Database=excalib;Uid=user;Pwd=pwd
And... it does nothing. I got nothing from my server (ERR_EMPTY_RESPONSE) There's nothing in apache's log. If I do a typo mistake on purpose on the driver path, it sends a correct error
Fatal error: Uncaught PDOException: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so1' : file not found in /var/www/html/test.php:24 Stack trace: #0 /var/www/html/test.php(24): PDO->__construct('odbc:Driver={SQ...') #1 {main} thrown in /var/www/html/test.php on line 24
And... I'm lost. Someone can help me ? Or maybe has another solution to connect to SQLAnywhere database ?
Thank you.
Edit [thank to Nitrex] : When I try to connect via php, tcpdump doesn't capture anything, so I think the problem come from Debian side.