Advertisement
Guest User

pyodbc

a guest
May 16th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import pyodbc
  2. print pyodbc.version
  3.  
  4. con_pq = pyodbc.connect('DRIVER={PostgreSQL Unicode};SERVER=146.156.114.11;PORT=5432;DATABASE=databasename;USERNAME=admin_login;PASSWORD=passwordwithnums34')
  5.  
  6. # Open a cursor to perform database operations
  7. c_pq = con_pq.cursor()
  8.  
  9. r = c_pq.execute("""select 5""")
  10. for i in r:
  11.     print i
  12.  
  13. #con_pq.commit()
  14. c_pq.close()
  15. con_pq.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement