You could try to telnet your server at port 1433. It is the port SQL Server is listening to:
telnet MySQLServerAddress 1433
The output should be
Trying 111.222.111.222 ... (example)
Connected to MySQLServerAddress.
If you receive a 'Connection refused' error message, you're there is something wrong with the network communication (firewall on server, SQL Server port was changed from default, ...)
To exit telnet when connected, type the escape character Ctrl-]
. Once in command mode, telnet may be exited with the command 'quit
.'
If the basic network communications is working, you could test accessing the database server using "tssql
":
It can be run in two ways, one which uses freetds.conf
and one which connects directly using address/hostname and port bypassing freetds.conf
. Try to connection using host and port first:
$ cd src/apps
$ TDSVER=7.0 ./tsql -H SQLServerHost -p 1433 -U user
If you receive 'Login Failed,' then you have a authentication issue.
If you receive a message like
Msg. No.: 18450 Severity: 14 State: 1
Login failed- User: loginid Reason:
Not defined as a valid user of a
trusted SQL Server connection
SQL Server is accepting only "domain" logins. This applies only to Microsoft SQL Server and you'll need to have your DBA verify that "server logins" are allowed, or use a domain login.
if you receive a prompt, then try tsql using the dataserver name (using freetds.conf):
$ ./tsql -S SQLServerHost -U user
If this fails, FreeTDS is either not finding the right freetds.conf
file, or there is an error in the file.
Solved. Should've used the stable release.. 0.8.2 supports tds 8.0, 0.8.3 does not. duh.
which, by the way, still does not explain why i was able to connect up to my mssql server with tsql, using protocol 7.1, but not with php5-mssql.
Best Answer
Found the answer here: http://jonkinney.com/articles/2009/11/23/change-locale-on-os-x-snow-leopard-for-freetds-functionality
The problem was that my locale encoding needed to be set to UTF-8
After that, I was able to connect with version 8.0 of the TDS protocol.