Problem inserting into Postgres (PgSQL) database

mupeso at mupeso at
Thu Jun 19 11:29:25 CEST 2003

Hello group,

Linux, Python 2.2

I'm having trouble writing in a PostgresSQL database. I can read 
the database just fine, but I can't add anything to the database, 

here part of my code, what am I doing wrong?

Thanks in advance,
Mwepu Mupeso

configDB= 'userdb2'
configHost = 'localhost:5432'
configUser = 'me'~~  ~
configPasswd= '1234'
handle= None
xcursor= None
result= None

~handle=PgSQL.connect(database=configDB, host=configHost, user=configUser, 
except PgSQL.OperationalError, e:
~print 'Erreur.'

sql= "insert into radcheck2 (uid,login,passwd,shell,homedir,domain_name,acc_ex
pired) values ("+str(uid) +",'"+login+"','"+passwd+"','"+shell+"','"+homedir+"

~xcursor = handle.cursor()~~~
~result= xcursor.execute(sql)~~~~
except PgSQL.OperationalError, e:
~print 'ERROR'

Sent by ePrompter, the premier email notification software.
Free download at

More information about the Python-list mailing list