tsql login failed but management studio can connec

2019-08-06 02:18发布

问题:

I'm trying to connect to a MS SQL Server instance using tsql (to troubleshoot not being able to connect with django-pymssql).

I can connect fine to the server (running on Amazon RDS, latest SQL Server version from on there) from a VM running SQL Server management studio, but from my native Ubuntu 15.10 env I get a login failed error.

Using the following:

tsql -H <hostname> -p 1433 -U <user> -P <mypassword>

I get:

locale is "en_GB.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" Msg 18456 (severity 14, state 1) from EC2AMAZ-U1TAK71 Line 1: "Login failed for user 'sa'." Error 20002 (severity 9): Adaptive Server connection failed There was a problem connecting to the server

As I can connect in management studio with mixed mode auth using the same creds I'm suspecting this isn't the real error.

Anyone have any ideas how I can troubleshoot?

tsql -C shows:

Compile-time settings (established with the "configure" script) Version: freetds v0.91 freetds.conf directory: /etc/freetds MS db-lib source compatibility: no Sybase binary compatibility: yes Thread safety: yes iconv library: yes TDS version: 4.2 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: yes

Thanks loads for any pointers.!

(Accidentally posted this to AskUbuntu so have moved here. Sorry).

回答1:

Answering my own question. Turns out it was down to the password being too long. I experimented with it, and any password longer than 30 characters didn't work. Seems to be a known issue with freetds.

Thanks.