Delta
Delta

Reputation: 2022

How to connect to a DB on windows

I have 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?

Upvotes: 0

Views: 146

Answers (3)

Delta
Delta

Reputation: 2022

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 ) 

Upvotes: 0

mouad
mouad

Reputation: 70031

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

Upvotes: 0

ars
ars

Reputation: 123528

The pymssql library is one option.

Upvotes: 2

Related Questions