From: <Ale...@di...> - 2002-03-23 04:22:47
|
I am putting together a simple application which has to update an MSSQL database. Here is what I do: database = "jdbc:microsoft:sqlserver://localhost:1433" dbuser = "user" dbpass = "password" driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver" db = zxJDBC.connect(database, dbuser, dbpass, driver) dbcursor = db.cursor() dbcursor.execute("Use PRS") ............................... batchname = 'abcdef' # generated as the application goes through a couple of directories curtime = time.strftime("%m-%d-%Y %H:%M:%S",time.localtime()) stmt = "INSERT INTO dbo.FTP_Recon (Batch_name, Date_sent) VALUES ('%s','%s')" % (batchname,curtime) cursor.execute(stmt) ...... dbcursor.close() db.close() So, what happens is this: when I run the whole script, it doesn't seem to update anything. However, if I start the query analyzer after I run the script, it seems like mssql is messed up because if I run a query on it, it wouldn't go for quite a while. Now, if I run these commands at the python shell, they execute ok. After I do the insert statement, if I do a "select * from FTP_recon" it gives me a result , reflecting the insert statement. However, if I run a query in the query analyzer to see whether the database has updated, it shows me that it hasn't. Any ideas / hints why it is not inserting the data , or it is not commiting the data to the database ? Btw, it is not a permissions problem in the mssql since I log into query analyzer with the same username that I use in the script...Also, when I run the same query in the query analyzer, it works just fine. Thanks, Alex Kotchnev Diversified Information Technologies |