Re: Behavior of Connection.commit()
- From: Joe Weinstein <joeNOSPAM@xxxxxxx>
- Date: Tue, 24 Jan 2006 17:20:41 -0800
Wes Clark wrote:
I'm interested in Microsoft's response. Does anyone know what the JDBC spec says here? Does it say "commit" and "rollback" and other SQL commands that affect the transaction state are not allowed? If so, should the driver throw an error? That would also require parsing, of course.
How about in a batch of statements? How sure can the driver ever be about the state of the transaction?
We will await MS's response. In the meantime, the spec says nothing. It also doesn't say what happens if the JDBC driver sends "shutdown" SQL to the DBMS either. A batch of statements doesn't add any more complexity. The driver must assume the transactional status is as it was set the last time via JDBC. Drivers will never parse SQL for transactional semantics, let alone presume to react to them, and stored procedures or even triggers could easily subvert any such effort. I can promise you as a former JDBC spec member and co-author of the first commercial JDBC drivers on the market for MS SQLServer, Sybase, Oracle, and Informix, and as a DBMS guy (joe@xxxxxxxxxx '88-'96) that you should always define, control and terminate a tx with only one API and in one logical place. Good luck, I want you to be successful. Joe Weinstein at BEA Systems
"Joe Weinstein" wrote:
Wes Clark wrote:
It turns out in very limited circumstances in a few test programs, we were sending a "commit" sql statement to the database. A developer found this in a trace we send in. This was messing up the driver. And I don't think this is related to most of the discussion on this thread.
I would suggest that if the driver needs to keep track of the state of the transaction, it would be advisable to look for SQL statements that would affect that state. I don’t think the JDBC spec would say you can’t commit a transaction using the SQL.
I'd take the other position. The load imposed by the driver having to parse all the SQL, looking for commits, rollbacks etc in SQL would be onerous and inappropriate. It would be clearly poor style to distribute control of transactions between JDBC and SQL. Procedures could have 'commit' in them and the driver could never know.
I imagine the other drivers do that very thing. Do you accept this as a “bug” and/or should I enter this somewhere else?
They don't. I highly recommend controling your transactions within a top-level method that does all the tx work and then calls commit() or rollback, or letting a tx-capable container do it all for you. Joe Weinstein at BEA Systems
Thank you for helping us get back on the road.
.
- Follow-Ups:
- Re: Behavior of Connection.commit()
- From: Angel Saenz-Badillos[MS]
- Re: Behavior of Connection.commit()
- References:
- Re: Behavior of Connection.commit()
- From: Joe Weinstein
- Re: Behavior of Connection.commit()
- From: Joe Weinstein
- Re: Behavior of Connection.commit()
- From: Angel Saenz-Badillos[MS]
- Re: Behavior of Connection.commit()
- From: Joe Weinstein
- Re: Behavior of Connection.commit()
- From: Angel Saenz-Badillos[MS]
- Re: Behavior of Connection.commit()
- From: Joe Weinstein
- Re: Behavior of Connection.commit()
- From: Sam Wilson
- Re: Behavior of Connection.commit()
- From: Angel Saenz-Badillos[MS]
- Re: Behavior of Connection.commit()
- From: Joe Weinstein
- Re: Behavior of Connection.commit()
- Prev by Date: Re: Error setting up static cursor cache.
- Next by Date: Re: Behavior of Connection.commit()
- Previous by thread: Re: Behavior of Connection.commit()
- Next by thread: Re: Behavior of Connection.commit()
- Index(es):
Relevant Pages
|
Loading