Python adodb

LenS lsumnler at uniqueinsuranceco.com
Wed Oct 12 21:29:15 EDT 2005


I have used the following code in ADO:

# The following code creates a connection object,
# assigns the connection string, opens the
# connection object, and then verifies a good
# connection.

oConn = Dispatch('ADODB.Connection')

oConn.ConnectionString = "Provider=SQLOLEDB.1;" +\
                         "Data Source=servername;" +\
                         "uid=loginid;" +\
                         "pwd=password;" +\
                         "database=databasename"

oConn.Open()
if oConn.State == adStateOpen:
    print "Database connection SUCCEEDED"
else:
    print "Database connection FAILED"

Hope this helps




More information about the Python-list mailing list