-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Autocommit with tomcat JNDI sources
PostPosted: Wed Mar 09, 2005 4:52 pm 
Newbie

Joined: Tue Mar 08, 2005 5:05 pm
Posts: 9
Hi guys, anyone had any lucking turning OFF autocommit for a connection pool managed via tomcat (using JNDI resource)? I can't seem to get it to switch and I'm hoping someone else has. The only thing I've found via searching the forums is someone who had the problem but dropped using tomcat managed pools as his solution (not viable for me).

Hibernate version: 3.0b4b
hibernate.cfg.xml (edited for readability)
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.datasource">java:comp/env/jdbc/testk</property>
<property name="connection.autocommit">false</property>
</session-factory>
</hibernate-configuration>

Resource defined in tomcat 5.5 server.xml
<Resource
name="jdbc/test"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
password="diasn."
autocommit="false"
maxIdle="2"
maxWait="5000"
username="root"
url="jdbc:mysql://localhost/test"
maxActive="4"/>

Code
catch(Throwable ex)
{
out.println("<br>error found: " + ex.getMessage() + "<br>");
if (tx != null)
tx.rollback();
}

Exception
Mar 9, 2005 3:17:04 PM org.hibernate.transaction.JDBCTransaction rollback
SEVERE: JDBC rollback failed
java.sql.SQLException: Can't call rollback when autocommit=true

Thanks in advance
Sean


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.