I implemented this code:
DataSource ds = (DataSource)
new InitialContext().lookup("jdbc/MyDS"); // replace this with your datasource deployed in JBossConnection con = ds.getConnection();
System.out.println("Connection is " + con.getClass().getName());
org.jboss.resource.adapter.jdbc.WrappedConnection wc = (WrappedConnection) con;
Connection uc = wc.getUnderlyingConnection();
System.out.println("Underlying Connection is " + uc);
And I get this error:
13:48:50,276 INFO [STDOUT] Connection is $Proxy339
13:48:50,276 ERROR [STDERR]
java.lang.ClassCastException: $Proxy339 cannot be cast to org.jboss.resource.adapter.jdbc.WrappedConnection