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
|