"Surprising Results in Transactio"
vickyk Oct 31, 2002 7:56 AMHi All,
Ultimately I got the Transaction working from the Jsp,but this does not solve all my problem.Before I could go for some distributed Transaction I wanted to clear some doubts regarding the working of Jboss3.0.2.Folling code is working fine :
<%@ page import="javax.naming.*,javax.sql.*,java.sql.*,javax.transaction.*" %>
<%
Context ocontext=new InitialContext();
UserTransaction trans=(UserTransaction)ocontext.lookup("UserTransaction");
//trans.setTransactionTimeout(20);
trans.begin();
DataSource ods=(DataSource)ocontext.lookup("java:/OracleDSI");
Connection ocon=ods.getConnection();
System.out.println("First");
PreparedStatement ostmt=ocon.prepareStatement("update gangsterejb set name=? where id = ? ");
ostmt.setString(1,request.getParameter("name"));
ostmt.setInt(2,3);
ostmt.executeUpdate();
System.out.println("Second");
ocon.close();
if(request.getParameter("rollback")==null)
trans.commit();
else
trans.rollback();
System.out.println("After Committing");
out.println(trans+"");
%>
But the JTA/JTS specifications are telling some different things,In specifications it has been mentioned that the Transaction Manager can handle XADataSources but to my surprise I am able to handle the transaction without the XA type.Can you guys clear me this ?
I am using Jboss3.0.2,j2sdk1.4.0,Oracle8i.
Secondly I was trying to get Connection from the db2 ,the DataSource is getting configured but when I request connection from it the following error appears
org.jboss.util.NestedSQLException: Failed to register driver for: COM.ibm.db2.jd
bc.app.DB2Driver; - nested throwable: (java.sql.SQLException: java.lang.Unsatisf
iedLinkError: no db2jdbc in java.library.path); - nested throwable: (org.jboss.r
esource.ResourceException: Failed to register driver for: COM.ibm.db2.jdbc.app.D
B2Driver; - nested throwable: (java.sql.SQLException: java.lang.UnsatisfiedLinkE
rror: no db2jdbc in java.library.path))
I think it is because I have j2sdk1.4.0 , but I did not check it as I have been working on this version.Can you share some info on this also?
Thanks
Regards
Vicky