1 Reply Latest reply on Dec 12, 2002 1:18 PM by Jonny Miller

    access to oracle.jdbc.driver.OracleConnection through LocalC

    Jeroen Coppieters Newbie

      Environment: jboss 3.0.3 - JDK 1.4.1 - Oracle ojdbc14.jar
      I have configured a local conneciton pool to access Oracle as:

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      filepool



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@dropit:1521:DRP1</config-property>
      <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
      <!--set these only if you want only default logins, not through JAAS -->
      <config-property name="UserName" type="java.lang.String">AEM_POOL_USER</config-property>
      <config-property name="Password" type="java.lang.String">AEM_POOL</config-property>




      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper



      SO I assume this will use the oracle implementation of java.sql.Connection etc (i.e. oracle.sql.OracleConnection)
      In my EJB, I obtain a connection from the DataSource and
      try to cast this to oracle.sql.OracleConnection but this fails with ClassCastException
      my bean seems to get hold of a org.jboss.resource.adapter.jdbc.local.LocalConnection. On working through the source, this seems to be a wrapper round the real connection.
      two questions:
      - is there a way to access the oracle.sql.OracleConnection instance, so I can make use of the Oracle extensions?
      - what is the rationale for wrapping the connection provided by the vendor with a JBoss wrapper?

      Jeroen

        • 1. Re: access to oracle.jdbc.driver.OracleConnection through Lo
          Jonny Miller Newbie

          I had this same type of problem. Fortunately, LocalConnection exposes a getUnderlyingConnection() method that returns the actual connection. You will have to cast to a LocalConnection first, then get the underlying connection from that. You will find the JAR containing the LocalConnection class within the jboss-local-jdbc.rar in the default deploy directory.

          Connection local = ds.getConnection();
          if (local instanceof LocalConnection) {
          Connection underlying = ((LocalConnection) local).getUnderlyingConnection();

          // Now cast to OracleConnection and perform specifics
          }