Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyodbc
- server = 'xxxxxxxxDEV'
- database = 'SandBox'
- username = 'zzzzzzz'
- password = 'xxxxxxx'
- driver = '{SQL Server}'
- cnxn = pyodbc.connect('DRIVER='+driver+';PORT=4853;SERVER='+server+';PORT=4853;DATABASE='+database+';UID='+username+';PWD='+ password)
- cursor = cnxn.cursor()
- cursor.execute("select * from fieldscreenscheme ")
- row = cursor.fetchone()
- if row:
- print row
- cnxn = pyodbc.connect('DRIVER='+driver+';PORT=43853;SERVER='+server+';PORT=43853;DATABASE='+database+';UID='+username+';PWD='+ password)
- pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect); [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). (53); [01S00] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute (0)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement