1 Reply Latest reply on Aug 18, 2009 11:10 AM by Gu Lo

    Wrapping to OracleConnection problem.

    ford farline Newbie

      Hi all,

      I using JBoss 4.2.3 and i need to get an OracleConnection to be able to pass an array as parameter to a PreparedStatement. I get an exception when i cast de connection:

      java.lang.ClassCastException: $Proxy1 cannot be cast to org.jboss.resource.adapter.jdbc.WrappedConnection

      I don´t know what i am doing wrong. This is my code:

      DataSource ds = (DataSource) context.lookup("MLS/SRVC/AdministrationDataSource");

      Connection con = ds.getConnection();

      // The exception is thow here
      WrappedConnection wrappedConn = (WrappedConnection)con;

      OracleConnection ocon = (OracleConnection) wrappedConn.getUnderlyingConnection();

      // This is what i need to do.
      ArrayDescriptor af = ArrayDescriptor.createDescriptor("MDSYS.SDO_ORDINATE_ARRAY", con);


      And this is the xml descriptor:

      <no-tx-datasource>
      <jndi-name>MLS/SRVC/AdministrationDataSource</jndi-name>
      <use-java-context>false</use-java-context>
      <connection-url>jdbc:oracle:thin:@x.x.x.x:1521:xxx</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>xxx</user-name>
      xxx
      <min-pool-size>3</min-pool-size>
      <max-pool-size>10</max-pool-size>
      <idle-timeout-minutes>3</idle-timeout-minutes>
      <track-statements>true</track-statements>
      <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

      <type-mapping>Oracle 9i</type-mapping>

      </no-tx-datasource>

      Thanks for any help or clue