users@glassfish.java.net

RE: defaultAutoCommit and JDBC Connection Pool

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Fri, 23 Apr 2010 12:34:40 -0400

not in the declarators but you can disable Autocmmit by setAutoCommit(false) on the acquired connection handle e.g.

Compiled from "Connection.java"
public interface java.sql.Connection extends java.sql.Wrapper{
    public abstract void setAutoCommit(boolean) throws java.sql.SQLException;
........
}
conn.setAutoCommit(false);

Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 23 Apr 2010 08:44:43 -0700
> From: glassfish_at_javadesktop.org
> To: users_at_glassfish.dev.java.net
> Subject: defaultAutoCommit and JDBC Connection Pool
>
> Hi,
>
> I am using Glassfish 2.1 with ESB.
>
> When I do my development on my laptop, I find that I cannot use Glassfish JDBC Connection Pools, as for some reason a full Glassfish restart is required every time I redeploy a WAR that uses the pools.
>
> So when working locally I don't use Glassfish connection pooling, but instead use Spring connection pooling.
>
> Spring works nicely with the property defaultAutoCommit=false.
>
> I can then invoke stored procedures, which are written such that they only do a final COMMIT if everything works.
>
> My problem is that when I deploy to the target Solaris Glassfish environment, and I switch to using the Glassfish connection pooling, the stored procedures that I call ALWAYS get committed.
>
> This is the data source bean:
>
> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
> <property name="jndiName" value="jdbc/develop-jdbc-resource-1"/>
> </bean>
>
> This is the bit from my domain.xml that defines the connection pool:
>
> <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="true" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="oracle.jdbc.pool.OracleConnectionPoolDataSource" fail-all-connections="false" idle-timeout-in-seconds="60" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="5" name="develop-jdbc-pool-1" non-transactional-connections="true" pool-resize-quantity="2" res-type="javax.sql.ConnectionPoolDataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" transaction-isolation-level="read-committed" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
> <property name="URL" value="jdbc:oracle:thin:@DEVELOP"/>
> <property name="user" value="DEVELOP"/>
> <property name="password" value="DEVELOPPW"/>
> <property name="networkProtocol" value="tcp"/>
> <property name="portNumber" value="1522"/>
> <property name="ExplicitCachingEnabled" value="false"/>
> <property name="MaxStatements" value="0"/>
> <property name="TNSEntryName" value="DEVELOP"/>
> <property name="databaseName" value="DEV1"/>
> <property name="DataSourceName" value="OracleConnectionPoolDataSource"/>
> <property name="LoginTimeout" value="0"/>
> <property name="ImplicitCachingEnabled" value="false"/>
> <property name="DefaultAutoCommit" value="false"/>
> <property name="defaultAutoCommit" value="false"/>
> </jdbc-connection-pool>
>
> Can anybody help me? What am I doing incorrectly?
>
> Thank you very much!
> [Message sent by forum member 'm_jenkins']
>
> http://forums.java.net/jive/thread.jspa?messageID=398695
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
                                               
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2