Guest User

Untitled

a guest
Mar 22nd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import pyodbc
  2. server = 'xxxxxxxxDEV'
  3. database = 'SandBox'
  4. username = 'zzzzzzz'
  5. password = 'xxxxxxx'
  6. driver = '{SQL Server}'
  7.  
  8. cnxn = pyodbc.connect('DRIVER='+driver+';PORT=4853;SERVER='+server+';PORT=4853;DATABASE='+database+';UID='+username+';PWD='+ password)
  9. cursor = cnxn.cursor()
  10. cursor.execute("select * from fieldscreenscheme ")
  11. row = cursor.fetchone()
  12. if row:
  13. print row
  14.  
  15. cnxn = pyodbc.connect('DRIVER='+driver+';PORT=43853;SERVER='+server+';PORT=43853;DATABASE='+database+';UID='+username+';PWD='+ password)
  16.  
  17. 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)')
Add Comment
Please, Sign In to add comment