users@glassfish.java.net

Re: getNonTxConnection

From: <glassfish_at_javadesktop.org>
Date: Tue, 11 Aug 2009 22:56:52 PDT

By doing Connection drivercon = ds.getConnection(con); u are getting the physical connection of the non tx connection you have got.
Instead of using drivercon.prepareStatement( use con.prepareStatement( in your code.

The ds.getNonTxConnection() could be used to obtain a connection that is not in the scope of a transaction. A simple example would be to get a normal connection within a transaction and perform an insert into a db table. If a NonTxConnection is got just after this within the same transaction and a select is performed with this nonTxConn, the data inserted previously is not got, because the transaction is not yet committed and the nonTxConn is not part of that transaction.
[Message sent by forum member 'sm157516' (sm157516)]

http://forums.java.net/jive/thread.jspa?messageID=360013