4 Replies Latest reply on May 16, 2018 3:23 PM by sant_kaly

    Wrapped connection for the wildfly

    sant_kaly

      Migrating Jboss to wildfly and encounter issue with the java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7 cannot be cast to org.jboss.resource.adapter.jdbc.WrappedConnection

      how we can call stored procedures, array descriptor in wildfly with jboss 8.

      Using ojdb4, if i keep the ojdbc6 also getting the same exception.

      Problem is how we can call the storedprocedures throigh jdk8/wildfly classes and oraclecallablestatements.

        • 1. Re: Wrapped connection for the wildfly
          mayerw01

          You can get the Connection object either via:

           

          connection = DriverManager.getConnection( url, username, password)

           

          or

           

          @Resource(mappedName = "{JNDI-Name}")

              DataSource ds;

            ....

           

             connection = ds.getConnection();

          • 2. Re: Wrapped connection for the wildfly
            sant_kaly

            am able to get the connection, but with this connection object we can't call the preparecall() and we can't create the array parameter from string[] because ArrayDescriptor expect the wrappedconnection object.

            How can i use in my Jdk8 with the wildfly?

            • 3. Re: Wrapped connection for the wildfly
              mayerw01

              "So, the 11.2 Oracle JDBC drivers do not and cannot support the createArrayOf method." (JDBC Standards Support

               

              As mentioned in the Spec you may use the createARRAY method instead.

              So something like this should work:

               

              int [] iarray = {17, 18,19};

               

              OracleConnectionWrapper ocw = new OracleConnectionWrapper((OracleConnection) connection);

              OracleConnection oc = ocw.unwrap();

              ARRAY ocArray = oc.createARRAY("{databaseElement}".toUpperCase(), iarray);

               

              (Working with Oracle Collections )

              • 4. Re: Wrapped connection for the wildfly
                sant_kaly

                we need to specify  in the global modules of standalone.xml

                <module name="com.oracle.jdbc" slot="main"/>

                                <module name="org.jboss.ironjacamar.jdbcadapters" slot="main"/>