[jboss-user] Fail to get tables by a remote Datasource deployed in JBOSS

Zeke xanadu860122 at gmail.com
Tue Aug 25 22:36:02 EDT 2009

Hi, all:

      I try to use DatabaseMetaData to get all tables and views from a
Oracle database. But exception is thrown at the red line. You can see that I
look up a remote DataSource and get connection from the data source. But if
I use *DriverManager.getConnection(url, user, pwd)* way to get connection.
This issue does not exist. I can get all the tables and views successfully…

      Any help from you will be much appreciated!

*public* *class* Test {

    *public* *static* *void* main(String[] args) *throws* Exception {

        Properties props = *new* Properties();

        props.put(Context.*PROVIDER_URL*, "jnp://");


        Context ctx = *new* InitialContext(props);

        DataSource ds = (DataSource)ctx.lookup("OracleDS");

        Connection conn = ds.getConnection();

        DatabaseMetaData dbmd = conn.getMetaData();

        ResultSet *rs* = dbmd.getTables(*null*, "%", "%", *new* String[] {
"TABLE", "VIEW" });




       Exception in thread "main" *java.lang.ClassCastException*: $Proxy3

    at $Proxy2.getTables(Unknown Source)

    at Test.main(*Test.java:62*)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20090826/6d7000f0/attachment.html 

More information about the jboss-user mailing list