On Mon, Oct 26, 2009 at 4:46 PM, Anand Chitipothu <[email protected]>wrote:
> > 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
>
> You are trying to pass all db parameters. You should be doing some
> thing like this:
>
> conn = psycopg2.connect(dbname=dbname, user=dbuser, password=dbpass)
>
> Anand
>
Now I did it . The code will be now
dbcs = "dbname=%s user=%s host='localhost' password=%s" %(dbname,
dbuser,dbpass)
try:
dbconn = psycopg2.connect( dbcs )
except:
raise
Thanks
--
**********************************
JAGANADH G
http://jaganadhg.freeflux.net/blog
Sent from Chennai, TN, India
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers