Want more features on Pastebin? Sign Up, it's FREE!
Guest

pyodbc

By: a guest on May 16th, 2012  |  syntax: Python  |  size: 0.37 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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()
clone this paste RAW Paste Data