title: How to connect to SQL Anywhere database from linux?
body: <p>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.</p>
  
  <p>Windows side :
  I have installed SQL anywhere driver from <a href="https://archive.sap.com/documents/docs/DOC-35857" rel="nofollow noreferrer">https://archive.sap.com/documents/docs/DOC-35857</a>, and connect with odbc:Driver={SQL Anywhere 16};Server=serveur-02;Port=2638;Database=excalib;Uid=username;Pwd=pwd;
  Ok, it works.</p>
  
  <p>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 :</p>
  
  <pre><code>[SQLAnywhere16]
  Description     = SQLAnywhere driver
  Driver  = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
  Setup   = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
  </code></pre>
  
  <p>And in odbc.ini :</p>
  
  <pre><code>[Excalibur]
  Description     = Excalibur
  Driver  = SQLAnywhere16
  Server  = [ip]
  Port    = 2638
  Name    = excalib
  User    = user
  Password        = password
  </code></pre>
  
  <p>With command </p>
  
  <pre><code>isql -v Excalibur
  </code></pre>
  
  <p>I got </p>
  
  <pre><code>[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
  </code></pre>
  
  <p>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 ?</p>
  
  <p>Next step is to do it with php.</p>
  
  <pre><code>odbc:Driver={SQLAnywhere16};Server=[ip];Port=2638;Database=excalib;Uid=user;Pwd=pwd
  </code></pre>
  
  <p>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</p>
  
  <pre><code>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-&gt;__construct('odbc:Driver={SQ...') #1 {main} thrown in /var/www/html/test.php on line 24
  </code></pre>
  
  <p>And... I'm lost. Someone can help me ? Or maybe has another solution to connect to SQLAnywhere database ?</p>
  
  <p>Thank you.</p>
  
  <p>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.</p>