2014-09-29 2 views
0

저는 우분투 14.04.1 86_x64 서버를 사용하고 있으며, MSSQL 2012 Contained Database에 연결하는 방법을 알아 내려고 노력하고 있습니다. 필자는 FreeTDS 드라이버를 사용하는 pymssql 2.1.0을 사용해 왔습니다. pymssql 웹 사이트를 기반으로 FreeTDS 드라이버에 문제가 있음을 확인했습니다.MSSQL에 연결합니다. 포함 된 데이터베이스와 우분투의 파이썬?

내가 tsql -H SERVER -p PORT -U USERNAME -P PASSWORD -D DATABASE 사용했습니다 내가 오류 얻을 :

Msg 18456 (severity 14, state 1) from SERVER Line 1:

"Login failed for user 'USERNAME'." 

Error 20002 (severity 9):

Adaptive Server connection failed 

There was a problem connecting to the server

내가 포함 된 데이터베이스를 지원하지 않는 MSSQL 2008 데이터베이스에 연결 같은 문제를 필요는 없습니다. 또한 데이터베이스에 대한 설정을 제어 할 수 없습니다.

답변

0

pymssql 2.1.1이 'Azure와의 호환성'의 일부로이를 수정 한 것으로 확인되었습니다.

수정 된 코드는 github에서 찾을 수있는 _mssql.pyx의 606-613 행에 있습니다. 나는 참조 용으로 여기에 줄을 둡니다.

# Put the DB name in the login LOGINREC because it helps with connections to Azure 
if database: 
    if FREETDS_SUPPORTS_DBSETLDBNAME: 
     dbname_bytes = database.encode('ascii') 
     dbname_cstr = dbname_bytes 
     DBSETLDBNAME(login, dbname_cstr) 
    else: 
     log("_mssql.MSSQLConnection.__init__(): Warning: This version of FreeTDS doesn't support selecting the DB name when setting up the connection. This will keep connections to Azure from working.") 
관련 문제