0 Replies Latest reply on Sep 6, 2005 4:12 AM by asinezhang

    JBoss Connection Pool & Oracle problem:getTables()

    asinezhang

      I've configed JBoss Connection Pool and the database is Oracle9i.
      But I met some error when I use getTables() method,there was an error. The code is as follow:

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      InitialContext ctx = new InitialContext(env);
      DataSource ds = (DataSource) ctx.lookup("OracleDS");
      try {
      Connection conn = ds.getConnection();
      DatabaseMetaData dm = conn.getMetaData();

      System.out.println(dm.getDriverName());
      System.out.println(dm.getDriverVersion());
      System.out.println(dm.usesLocalFiles());
      Object o= dm.getTables(null, null, "%", null);

      conn.close();
      } catch (SQLException e1) {
      e1.printStackTrace();
      }
      } catch (NamingException e) {
      e.printStackTrace();
      }

      The error message was:
      java.lang.ClassCastException
      at $Proxy2.getTables(Unknown Source)
      at testH.main(testH.java:43)
      Exception in thread "main"
      I'm confused, anyone can help me? thanks in advance!