sql server - freetds and pyodbc failing to connect -
I am currently a Microsoft set up a connection to SQL Server from a Linux box I FreeTDS Linux box and pyodbc set Have done
I have installed the following files: /etc/freetds/freetds.conf
[sqlserver] host = & lt; IP Address & gt; Port = 1433 TDS version = 8.0 client charset = UTF-8
~ / .odbc.ini
[sqlserver] Description = FreeTDS MSSQL driver = FreeTDS Server name = & lt; Like IP & gt; Database = Report TDS_Version = 8.0
/etc/odbcinst.ini
[FreeTDS] Description = FreeTDS MSSQL driver = / usr / lib / x86_64-linux -gnu / ODBC / libtdsodbc.so Driver64 = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so Setup64 = / usr / lib /x86_64-linux-gnu/odbc/libtdsS.so UsageCount = 1 CPTimeout = CPTimeToLive = DisableGetFunctions = DontDLCLose = ExFetchMapping = threading = FakeUnicode = IconvEncoding = trace = tracefile = TraceLibrary =
when I Trying to run Tsql -S sqlserver -U user-P password, I get the following error:
Locale "en_US.UTF-8" locale charset "UTF-8" default charset Yoga Doing SYM to "UTF-8" message 18452 (severity 14, state 1) PITIC03 Line 1: "Login failed logins from untrusted domain and can not be used with Windows authentication." Error 20002 ( Critical 9): There was a problem connecting to the server with the adaptive server connection failed
I also tried to connect with pyodbc, in the following script:
which prints the following error:
(' 001 ',' [ 001] [nxdc [re] SLSre] nbet onc odt ore (0) (SQLDriverConnect) ')
Really the most useful error message is not.
Do I connect something wrong?
As a side note, our DB requires Windows authentication, is not integrated. I can telnet to connect to the host, so this is not a problem either.
Using Windows authentication can be tricky ... and v Ery for the best practices of ugly:
- Create a SQL authenticated user in SQL Server to connect with limited privileges as possible. Note that, TDS version 8.0 will work, but to be correct, you should use TDS version 7.2:
- The TDS version has changed in 2012 and 2014, But backwards is consistent. I have not had any issues with Django with 2012 or 2014.
-
You will also need to change this line to include the TDS version:
cnxn = pyodbc .connect ('driver = freeTDS; server = same_ip_as_above; database = Report; UID = myusername; PWD = mypassword; TDS_Version = 7.2; ')
Best of luck; I believe that if you fix this, then the rest of the stack should be treated.
Regards,
-Tim
Comments
Post a Comment