- Timestamp:
- 07/05/08 10:16:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/db_funcs.py
r3844 r3852 5 5 import pgdb, logging, sys 6 6 7 def db_connect(databaseName ='discoverydb', hostName='localhost', userName='postgres', password='pass01word'):7 def db_connect(databaseName, hostName, userName, password, port='5432'): 8 8 ''' 9 9 Open a Postgres database connection … … 12 12 @param userName: Name of user to connect to DB as 13 13 @param password: Password for user 14 @param port: Port to use - defaults to 5432 14 15 ''' 15 16 logging.info("Setting up connection to DB: " + databaseName + " on " + hostName) 16 connection _string = hostName + ':' + databaseName + ':' + userName + ':' + password17 connection = pgdb.connect(connection_string)17 connection = pgdb.connect(host = hostName + ":" + port, database= databaseName, \ 18 user = userName, password = password) 18 19 logging.info("DB connection established") 19 20 return connection
Note: See TracChangeset
for help on using the changeset viewer.