Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JCA/JBoss] - I can't see Conneciton Sharing happening
 .

scott.stark@jboss.org

2007-05-05


I am making the <res-sharing-scope>Unshareable</res-sharing-scope> in the web.xml file , here goes the code .<resource-ref>
|     <description>DB Connection</description>
|     <res-ref-name>jdbc/testDS</res-ref-name>
|     <res-type>javax.sql.DataSource</res-type>
|     <res-auth>Container</res-auth>
|   <res-sharing-scope>Unshareable</res-sharing-scope>
|  </resource-ref>

I have a jsp which does the following
 InitialContext ctx = new InitialContext();
|  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/testDS");
|  UserTransaction utx = (UserTransaction)ctx.lookup("UserTransaction");
|  utx.begin();
|  Connection con = ds.getConnection();
|  out.println("First Connection --> "+con.toString()+"<br>");
|  WrappedConnection unlycon = (WrappedConnection)con;
|  out.println(unlycon.getUnderlyingConnection()+"<br>");
|  Connection con1 = ds.getConnection();
|  WrappedConnection unlycon1 = (WrappedConnection)con1;
|  out.println(unlycon1.getUnderlyingConnection()+"<br>");
|  out.println("Second Connection"+con1);
|  utx.commit();
|  con.close();
|  con1.close();
And I see the following result First Connection --> org.jboss.resource.adapter.jdbc.WrappedConnection@(protected)
| org.hsqldb.jdbc.jdbcConnection@(protected)
| org.hsqldb.jdbc.jdbcConnection@(protected)
| Second Connectionorg.jboss.resource.adapter.jdbc.WrappedConnection@(protected)

Since the resource sharing is defined as Unsharable I was expecting the underlying connection reference as different but it is not .
Am I missing some thing here ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043406#4043406

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043406
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.