0 Replies Latest reply on Sep 6, 2005 4:27 AM by Jason zhang

    ClassCastException at $Proxy2.getTables()

    Jason zhang Newbie

      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 followed:

      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!
      JBoss 4.0.1sp1, Oracle9i