techscope / laravel-sqlserver

Use ODBC to connect with your SQL Server instances from Laravel 5+
GNU General Public License v3.0
20 stars 9 forks source link

tcp port syntax vs Port attribute. #3

Open freak3dot opened 6 years ago

freak3dot commented 6 years ago

When connecting to my MS SQL server the following dsn created by this library didn't work.

odbc:Server=tcp:192.168.x.x,1433;Database=Example;Driver=FreeTDS

However, the following dsn does work.

odbc:Server=192.168.x.x;Port=1433;Database=Example;Driver=FreeTDS

The tcp syntax is created in the buildHostString method of ./src/SqlServerConnector.php. Is this the correct syntax? Is my server is just wonky?

I worked around by not setting port and setting host to 192.168.x.x;Port=1433. This was to avoid having to modify the code.

It should also be noted the omitting port from the dsn entirely didn't work for this connection either.