Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DATABASES = {
- 'db2': {
- 'ENGINE' : 'ibm_db_django',
- 'NAME' : 'SAMPLE',
- 'USER' : 'USERNAME',
- 'PASSWORD' : 'TOPSECRET',
- 'HOST' : 'localhost',
- 'PORT' : '50000',
- 'PCONNECT' : False, #Optional property, by default it is false
- }
- }
- try:
- db2_cursor = connections['db2'].cursor()
- except Exception, e:
- db2_cursor = False
- logger.error("db2-connection failure: %s" % e)
- def get_from_db2(search_id):
- sql_query = settings.DB2_SQLQUERY % search_id
- if not db2_cursor:
- logger.info(u"DB2 - no connection")
- return None
- db2_cursor.execute(sql_query)
- # do stuff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement