I am trying to connect an SQL server from an Ubuntu machine, everythings works great except for named instances:
this works
\'data\' =&g
I finally found a solution, there were two problems :
So I finally used a combination of FreeTDS DSN with laravel in order to connect the SQL named instance server.
The /etc/freetds.conf DSN configuration:
[NAMED_INSTANCE]
host = 127.0.0.1
port = 55021
And in the laravel database adapter:
'webcmd' => array(
'driver' => 'sqlsrv',
'host' => 'NAMED_INSTANCE',
'database' => 'db',
'username' => 'usr',
'password' => 'pwd',
'prefix' => '',
),
And that solved my problem, hope it'll help someone too
Thanks for the participation to solve this connection problem. I also encountered this problem, here is how I solved it.
For info in my case the connection with tsql works but not since Laravel (5.4)
One trick I took to understand is that it is not the default port (1433) that is used.
To find the port you must start a shell connection:
tsql -D DB -S "IP\INSTANCE" -U login -P pass
And check in the logs the good port here is 1168
Net.c: 1059: instance port is 1168
Contents of the file freetds.conf
[global]
text size = 64512
dump file = /var/log/freetds.log
dump file append = yes
[mssql]
host = MSSQLSRV
port = 1168
tds version = auto
instance = IP\INSTANCE
dump file = /var/log/freetds.log
dump file append = yes
Contents of the file : config/database.php
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => 'mssql',
'port' => '1168',
'database' => 'DB',
'username' => 'login',
'password' => 'pass',
'prefix' => '',
],
Now everything is working properly.