3 Replies Latest reply on Nov 21, 2002 9:09 AM by ykoer

    Oracle JDBC Problems

    rangelot

      I am trying to use SQL structured objects and Callable statements in a jsp/servlet environment. I am trying to connect to the Oracle database using JNDI. I have been able to successfully create StructDescriptor objects- but only when I connect without using JNDI. I thought it might be a JNDI problem so I created a simple test that would test my JNDI configuration and I was able to successfully create and execute a Statement object and scroll thru the ResultSet. The problem seems to be with StructDescriptor's and JNDI connections. Am I missing a classpath/jar file setting somewhere.

      FYI: the error I get whenever I try to execute the following CODE is: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.local.LocalDataSource

      CODE:
      Context ctx = new InitialContext();
      Context me = (Context) ctx.lookup("java:comp/env");

      OracleDataSource odsconn = (OracleDataSource)ctx.lookup("java:/OracleDS");

      Connection conn = odsconn.getConnection();

      StructDescriptor searchparms_desc = StructDescriptor.createDescriptor("PARTSEARCHPARMS", conn); <<-- Fails Here!


      Please Help!





        • 1. Re: Oracle JDBC Problems
          rangelot

          Sorry, I'm using JBOSS 3.0 and Jetty

          • 2. Re: Oracle JDBC Problems
            davidjencks

            For vendor specific features, you have to undo the wrapping and be careful not to get in the way of the jca implementation that is supplying the transactions, security and pooling for you.

            OracleConnection oc = (OracleConnection)(((LocalConnection)ds.getConnection()).getUnderlyingConnection());

            if I remembered the class names correctly.

            • 3. Re: Oracle JDBC Problems
              ykoer

              Hi David,

              if I use vendor specific JDBC functions (calling stored procs with varray as parameter) I get the following error:

              14:12:11,550 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedBy:
              java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.local.LocalConnection
              at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:87)

              You wrote that I have to undo the wrapping with the following statement:
              OracleConnection oc = (OracleConnection)(((LocalConnection)ds.getConnection()).getUnderlyingConnection());

              I couldn't find the package with the LocalConnection Class and the getUnderlyingConnection() method.

              Yusuf