[BangPypers] psycopg2 problem

JAGANADH G jaganadhg at gmail.com
Mon Oct 26 12:09:28 CET 2009


Dear All

I was trying to connect to postgre db with Python psycopg2 . The code for
connecting the db is

    import psycopg2

    try:
        dbconn = psycopg2.connect( "dbname=%s user=%s\
        host='localhost' password=%s" ) % ( dbname,dbuser, dbpass )
    except:
        raise

When I am running the program it throws the follwing error .
Traceback (most recent call last):
  File "test.py", line 228, in <module>
    retriveData(dbn, dbu, dbp, idb,odt)
  File "test.py", line 24, in retriveData
    host='localhost' password=%s" ) % ( dbname,dbuser, dbpass )
psycopg2.OperationalError: FATAL:  password authentication failed for user
"%s"

How to resolve this.

-- 
**********************************
JAGANADH G
http://jaganadhg.freeflux.net/blog


More information about the BangPypers mailing list