开发者

How to connect to a DB on windows

开发者 https://www.devze.com 2023-01-21 06:53 出处:网络
I hav开发者_开发问答e a SQL server 2005 server database on a server and need to conect to it from a client on the same server network, any ideas?The pymssql library is one option.see here for the ense

I hav开发者_开发问答e a SQL server 2005 server database on a server and need to conect to it from a client on the same server network, any ideas?


The pymssql library is one option.


see here for the ensemble of database connector:

http://wiki.python.org/moin/DatabaseInterfaces

for sql server see here:

http://wiki.python.org/moin/SQL%20Server


from win32com.client import Dispatch 

connection_string = "Provider=SQLNCLI;server=%s;initial catalog=%s;user id=%s;password=%s"%(server,db_name,user,pwd) 

dbConn = Dispatch("ADODB.Connection") 

dbConn.Open( connection_string ) 
0

精彩评论

暂无评论...
验证码 换一张
取 消