Difference between revisions of "Python DBI"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 1: | Line 1: | ||
=Links= | =Links= | ||
Line 9: | Line 8: | ||
* [http://wiki.oracle.com/page/Python Oracle Wiki] | * [http://wiki.oracle.com/page/Python Oracle Wiki] | ||
* http://cx-oracle.sourceforge.net/ cx_Oracle download from Sourceforge | * [http://cx-oracle.sourceforge.net/ cx_Oracle download from Sourceforge] | ||
=Exmples= | =Exmples= |
Revision as of 17:43, 28 August 2009
Links
DBI
DBD
Oracle
Exmples
#!/usr/bin/env python import dbi dbh = dbi.connect("DBI:mysql:database=mydatabase", "myysername", RaiseError = 1, PrintError = 0, AutoCommit = 1, ) try: dbh["AutoCommit"] = 0 except: print "Can't turn off AutoCommit" sth = dbh.prepare("select * from foo limit 5") sth.execute() while 1: row = sth.fetchrow_tuple() if not row: break print row dbh.disconnect()