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

Stephen Davidson gorky at freenet.carleton.ca
Wed Aug 26 11:24:06 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use a forum.  This list is apparently no longer monitored by anyone from
the JBoss group, and its gateway for the forums does not seem to be
working correctly any more.

Regards,
Steve


Zeke wrote:
> 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://10.111.3.161:1099
> <http://10.111.3.161:1099>");
> 
>         props.put(Context./INITIAL_CONTEXT_FACTORY/,
> "org.jnp.interfaces.NamingContextFactory");
> 
>         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:
> 
>        Exception in thread "main" _java.lang.ClassCastException_: $Proxy3
> 
>     at $Proxy2.getTables(Unknown Source)
> 
>     at Test.main(_Test.java:62_)
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> jboss-user mailing list
> jboss-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-user

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkqVU5UACgkQSphIUSiVzgaNTACffUlJkTw7UNRpfd5ICRwAJ8hE
6TYAn05SxoC4dnO+ZcIt23LDuhSqEqBF
=wnzP
-----END PGP SIGNATURE-----



More information about the jboss-user mailing list