Sql Server query with python -


new python in first week of me working it. download eclipse on home windows 7 computer. have added python engine , other things. decided go 3.4 learned latest software.

i need know how query table in sql server. everywhere says use pyodbc didn't make 1 3.4 .

thanks before hand.

there isn't official pyodbc python 3.4. however, bernie mentions in comment, can try 3.3 version. additionally, university of california, irvine provides unofficial build pyodbc python 3.4. there pypyodbc package, option.

in case, once decide on utilize, can use doing this. realize simple query.

import pyodbc # create connection con = pyodbc.connect(driver="{sql server}",server=servername,database=data_base_info,uid=username,pwd=password) cur = con.cursor() db_cmd = "select * table_name" res = cur.execute(db_cmd) # result set, example print out results: r in res:     print r 

in line beings con =, there several values fill in.

  • server needs server host information (either ip or dns name), , possibly port (default 1435) "dns.to.host.com,1435"
  • uid username logging in with
  • pwd password of user logging in with

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -