Hi Scott,
Thanks a lot for your reply.
Agreed, I was able to bind the datasource to global JNDI. But while trying to
get it from a remote client, I directly do not get back "javax.sql.DataSource"
instance, instead I get "javax.naming.Reference" object. Why is this? In case
of weblogic I can directly get a DataSource remotely.
Further, after spending lot of effort, I somehow got the DataSourec in a
contrived way using the following code (Honestly speaking, this is a cheap copy
of org.jboss.resource.adapter.jdbc.remote.DataSourceFactory):
Object obj = context.lookup("jdbc/OracleDS");
javax.naming.Reference ref = (javax.naming.Reference)obj;
BinaryRefAddr proxyAddr = (BinaryRefAddr)ref.get("ProxyData");
byte[] proxyBytes = (byte[])proxyAddr.getContent();
ByteArrayInputStream bi = new ByteArrayInputStream(proxyBytes);
ObjectInputStream ois = new ObjectInputStream(bi);
Object instance = ois.readObject();
if (instance instanceof javax.sql.DataSource){
// System.out.println("I am happy");
ds = (javax.sql.DataSource)instance;
}
However, now when I try to execute a JDBC statement as follows, I get an
"java.lang.reflect.UndeclaredThrowableException":
Connection con = ds.getConnection();
Statement st = con.createStatement(); // exception is thrown in this line.
Please help.
Regards,
Jitesh Kumar Popat
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865221#3865221
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3865221
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user