2

I am developing an laravel app using ubuntu as OS and my database is in a remote Azure Server. After long a research I'm about to give up. Installed freetds, php5-sybase etc etc.

here is my connection file: (the default is set to sqlsrv)

....

 'sqlsrv' => array(
    'driver' => 'sqlsrv',
    'host' => 'myhostname:myport',
    'database' => 'mydatabasename',
    'username' => 'myusername',
    'password' => 'mypassword' 
 ),

....

and the error that I am getting is this one:

  PDOException
  SQLSTATE[01002] Adaptive Server connection failed (severity 9)

Any sugestions? If you guys need more details please ask :)

Thanks in advance

Helder Lucas
  • 3,273
  • 2
  • 21
  • 26

3 Answers3

3

I solved my problem. It was missing @domain in my query string example:

$pdo = new PDO("dblib:host=xxxx:1433;dbname=yyyy", 'username@domain', 'password');
Helder Lucas
  • 3,273
  • 2
  • 21
  • 26
0

I get solution in Read from the server failed when trying to connect to sql-azure from tsql

Edit /etc/freetds/freetds.conf file and use 8.0 TDS version.

If haven't this file install FreeTDS with

sudo apt-get install freetds-bin
Community
  • 1
  • 1
0

Check these:

  1. port separator is "," on windows and ":" on linux/Mac. Since you have 1433, the default one, it is better probably not to use it at all
  2. definitely test first from command line using one of these : $ tsql -S sectionNameInFreetdsconf -U user -P pass $ tsql -H hostname -p port -U user -P pass
  3. locate freetds.conf on your disk. It is possible it exists in several places and tsql uses one while PHP used another one. Best is to symlink them into one common file and test on that. Note that a common place for that file is ~/.freetds.conf beside /etc/ or /usr/local/etc/

  4. there should be a [global] section on your freetds.conf file. Put there these lines :

    tds version = 8.0

    text size = 20971520

    client charset = UTF-8

Jorj
  • 2,495
  • 1
  • 19
  • 12