tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karambir Singh" <ksi...@etouch.net>
Subject RE: Tyrex transaction in Tomcat
Date Fri, 01 Feb 2002 18:42:39 GMT
Hi Randy,

I'm not calling connection.rollback. I am calling transaction.rollback(). I
think problem is that there is no link between transaction and datasource.
And on Tyrex forum they havn't answered a single question after October
2001.

Karambir

-----Original Message-----
From: Randy Layman [mailto:randy.layman@aswethink.com]
Sent: Friday, February 01, 2002 9:56 AM
To: 'Tomcat Users List'
Subject: RE: Tyrex transaction in Tomcat



	First, this is a database problem and you should be asking on one of
the Oracle or Tyrex forumns.

	Second, you are calling statement.close before connection.rollback.
Try switching the calls and you should see your rollback occur.

	Randy


> -----Original Message-----
> From: Karambir Singh [mailto:ksingh@etouch.net]
> Sent: Friday, February 01, 2002 1:26 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Tyrex transaction in Tomcat
>
>
> I'm using oracle 8.1.6, Tomcat 4.0.1 and tyrex-0.9.7.0.jar.
>
> In newtest.jsp when I try ut.rollback(), it does not
> rollback. The data is
> committed instead.
>
> What could be the problem. Anybody has working code using
> Tyrex Transaction
> framework in Tomcat. Or anybody has a document on how to
> integrate Tomcat4.0
> with Tyrex.
>
>
>
> SERVER.XML
> ----------
> 	<ResourceParams name="jdbc/eTaskPool">
>
> <parameter><name>user</name><value>arch</value></parameter>
>
> <parameter><name>password</name><value>arch</value></parameter>
>             <parameter><name>driverClassName</name>
>
> <value>oracle.jdbc.driver.OracleDriver</value></parameter>
>             <parameter><name>driverName</name>
>
> <value>jdbc:oracle:thin:@tiger:1521:etouch</value></parameter>
>       </ResourceParams>
>
> newtest.jsp
> -----------
>
> <%@ page import="emp, javax.sql.*, java.sql.*, javax.naming.*,
> javax.transaction.*, tyrex.tm.*" %>
>
> <%
> 	out.println("<p>Tomcat-Tyrex Integration Test");
> 	try
> 	{
> 		InitialContext  ctx;
> 		UserTransaction ut;
> 		DataSource      ds;
> 		Connection      conn;
> 		Statement       st;
> 		ResultSet       rs;
>
> 		ctx = new InitialContext();
> 		Context envCtx = (Context) ctx.lookup( "java:/comp/");
> 		ut = (UserTransaction) envCtx.lookup(
> "UserTransaction" );
> 		ds = (DataSource) ctx.lookup(
> "java:/comp/env/jdbc/eTaskPool" );
> 		conn = ds.getConnection();
> 		conn.setAutoCommit(false);
>
> 		ut.begin();
>
> 		st = conn.createStatement();
> 		rs = st.executeQuery( "SELECT EMPNO FROM EMP
> WHERE EMPNO=8" );
> 		if ( rs.next() )
> 		{
> 			out.println( "<p>Current value: " +
> rs.getString( 1 ) );
> 		}
> 		else
> 		{
> 			out.println( "<p>Current value: null" );
> 			st.executeUpdate( "INSERT into EMP values (8)");
> 		}
> 		rs.close();
> 		st.close();
> 		ut.rollback();
>
> 		conn.close();
>
> 		return;
> 	}
> 	catch ( Throwable except )
> 	{
> 		out.println( "<pre>except" );
> 		except.printStackTrace();
> 		out.println( "</pre>" );
> 	}
> %>
>
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message