Home
> Uncategorized > To access database in Python using ODBC connection
To access database in Python using ODBC connection
http://code.google.com/p/pyodbc/
To access Access Database in Python:
#database define
import pyodbc
DBfile = ‘C:\projTLcontrol\DB_TLcontrol.mdb’
conn = pyodbc.connect(‘DRIVER={Microsoft Access Driver (*.mdb)};DBQ=’+DBfile)
cursor = conn.cursor()
SQL = “UPDATE TL_TABLE SET TLX_HMICMD=” + “‘” + “0” + “‘” + \
“, TLX_LASTCMD=” + “‘” + “0” + “‘” + \
“, TLX_LASTCMDBY=” + “‘” + “NIL” + “‘” + \
” WHERE TLX=” + “‘” + “TLA” + “‘”
cursor.execute(SQL)
cursor.commit()
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback