|
Sean Abrahams
sa at sfsu.edu
Tue Jan 14 10:43:49 EST 2003
Thanks for all the replies, but I am indeed committing my statement.
Remember I said it worked when not using mod_python =).
Here's my dbDo function:
def dbDo(db, sql):
dbCon = dbConnect(db)
dbCursor = dbCon.cursor()
dbCursor.execute(sql)
dbCon.commit()
None of this really makes sense because the code seems to run fine,
giving back no errors. It doesn't even work when I tell it to
explicitly run commit via a sql statement.
I'm using cx_Oracle module to connect to an Oracle 8.1.6 database.
In mod_python must you first disconnect from a database, before
connecting to another one, within the same script?
Thanks for the help.
--Sean
Tuesday, January 14, 2003, 6:07:32 AM, you wrote:
YH> I am going to make a simple guess here. I might be wrong but I have been
YH> caught off guard when I forget to issue a commit statement. Maybe the
YH> database connections on the updates/inserts are not automatically
YH> committing.
YH> -----Original Message-----
YH> From: Sean Abrahams [mailto:sa at sfsu.edu]
YH> Sent: Monday, January 13, 2003 9:11 PM
YH> To: mod_python at modpython.org
YH> Subject: [mod_python] Database Help
YH> I'm implementing mod_python and everything is working fine, until I
YH> try to pass an UPDATE sql statement to a database.
YH> I'm grabbing info from one database, and inserting/updating into
YH> another database.
YH> When grabbing, I call upon my dbSelect(db, keys, sql, rows) function,
YH> which connects to a specified database (db) and selects the info.
YH> Works great.
YH> To update/insert I call upon my dbDo(db, sql) function. This function
YH> connects to the specified database (db) and runs the sql. Python wise
YH> everything seems to work fine. I call the dbDo and nothing appears to
YH> go wrong. Except when I look at the data in the db, it wasn't updated.
YH> All of this works fine from the interpreter, so I'm thinking it may
YH> deal with the way mod_python handles processes and dbconnections, of
YH> which I know very little of.
YH> Thus, does connecting to two different databases, right after one
YH> another, cause a problem in mod_python? I'm supposing I must change my
YH> dbConnect() function to take this into consideration due to the way
YH> mod_python/apache function.
YH> Some ideas? I want to learn!
YH> Thanks,
YH> --Sean
YH> Running:
YH> Apache/2.0.43 (Debian GNU/Linux) DAV/2 mod_python/3.0.1 Python/2.2.1
YH> cx_Oracle
YH> _______________________________________________
YH> Mod_python mailing list
YH> Mod_python at modpython.org
YH> http://www.modpython.org/mailman/listinfo/mod_python
|