Skip to content

Instantly share code, notes, and snippets.

@h3xh4wk
Created May 22, 2013 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3xh4wk/5626416 to your computer and use it in GitHub Desktop.
Save h3xh4wk/5626416 to your computer and use it in GitHub Desktop.
cx_Oracle with threads
import cx_Oracle
CONN_STR = """(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=%s)(PORT=%s))
(CONNECT_DATA=(SID=%s)))"""
CONN_STR = CONN_STR % (host, port, sid)
conn = cx_Oracle.connect(user, pwd, CONN_STR, threaded=True) # can connect using multi threads
conn.autocommit = True # will always use because could not figure out the place for explicit commit
"""
if not hasattr(self, "conn"):
self.conn = conn
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment