System.out.println("Connection class = " + con.getClass().getName());
// This returns "$Proxy55"
No this can not be true , I have tested it right now with oracle .
Can you try it again with simple jsp page and see if you still see the Proxy , it should be
How to retrieve the underlying Oracle connection object? Connection conn = myJBossDatasource.getConnection(); WrappedConnection wrappedConn = (WrappedConnection)conn; Connection underlyingConn = wrappedConn.getUnderlyingConnection(); OracleConnection oracleConn = (OracleConnection)underlyingConn;
Thanks for the reply. Even we are not sure why we getting the Proxy connection object in servlet. When we tried the same approach (i,e using DataSource) in EJB we getting the UnderlyingConnection. Can you let us know what exactly you tried to setup the JSP using DataSource.
What we did:
1) Created Datasource in -ds.xml file
2) Used the defined Datasource in our Servlet
Thanks in advance
Can you let us know what exactly you tried to setup the JSP using DataSource.
I did not try any rocket science there , all I did was this :)
<% InitialContext context = new InitialContext(); DataSource ds = (DataSource)context.lookup("OracleDS"); Connection con = ds.getConnection(); out.println("Connectio is "+con); %>
You need to isolate the problem yourself and get back to us with more concrete evidence ;)