Re: Behavior of Connection.commit()



We will definitelly be looking at this and the separate issue with
exceptions, I am glad to hear that the inmediate issue at least is resolved.

I can't think of a single driver in existance today for Sql Server that
handles both TSQL and API transaction handling simultaneously, making this
scenario work is going to be very tough. One thing we _could_ do would be to
throw an exception whenever we detect that this is happening, so we could
only begin, roll back, and commit transactions after verifying that the
transaction count on the server is what we expect at that point in time....
On the other hand this could be even more damaging...

--
Angel Saenz-Badillos [MS] DataWorks
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging: http://weblogs.asp.net/angelsb/




"Joe Weinstein" <joeNOSPAM@xxxxxxx> wrote in message
news:%23$luq2UIGHA.3944@xxxxxxxxxxxxxxxxxxxxxxx
>
>
> 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.
>>>>
>>>
>>>
>


.



Relevant Pages

  • Re: Behavior of Connection.commit()
    ... Does it say "commit" and "rollback" and other SQL commands that affect the transaction state are not allowed? ... How sure can the driver ever be about the state of the transaction? ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: SAP direct JDBC access
    ... > data with JDBC. ... > SQL Server. ... you can use a data source to hide the actual database ... driver used. ...
    (comp.lang.java.programmer)
  • Re: Retrieving data from SQL Server
    ... There are tons of examples. ... Microsoft has a free JDBC driver for the SQL Servers 7 and 2000. ...
    (comp.lang.java.programmer)
  • Re: MS Access databases
    ... >> If anyone knows of a JDBC driver for MS Access ... The list says that BCS has drivers of type 4, but that's only for SQL ... > Server, not MS Access... ...
    (comp.lang.java.databases)
  • Re: Asynchronous Stored Procedure Never Returns - Help?
    ... If you have the Sql Server 2000 or 2005 docs they are thorough and can be ... for Transaction SQL Reference from the drop-down or select a keyword from ... your query in Query Analyzer or Sql Server Management Studio, ...
    (microsoft.public.dotnet.languages.csharp)

Loading