JBoss Community

JBoss AS 7.1.0 not working with OCI driver

created by sridharts in JBoss AS 7 Development - View the full discussion

Hi,

  I have Jboss AS 4.05 currently and am migrating to JBoss AS 7.1.0. I installed Jboss7.1.0 and did the setup and everything works fine except the jdbc driver.

I have downloaded the instantclient from oracle website for oralce 11g (1.2.0.1.0)  in C:\ple\instantclient folder which has the ojdbc6.jar and ocijdbc11.dll and other dlls . My oracle database is in a different machine and its the same version(11.2.0.1.0.) 

 

I created a simple java program which does these things and it works fine and returns the results without any error.

       String driverClass = "oracle.jdbc.driver.OracleDriver";

        String connectString = "jdbc:oracle:oci:@sridb:1521:intpl";

        String userName = "myuser";

        String password = "mypass";

         String sql = "select count(id) from mytesttable";

      

        Class.forName(driverClass);

        cont = DriverManager.getConnection(connectString, userName, password);

        Statement stmt =  cont.createStatement(sql);

       stmt.executeQuery();

 

But when i do the exact same thing from a jsp inside the Jboss 7.1.0 server it doesnt work and gives a sql exception in DriverManager.getConnection() with no trace or detail message.

All the detailed message the SQLException had was some 4 wierd square shaped characters and those characters keeps changing too everytime i run it.

 

This same thing works fine with my Jboss 4.05 server with the oci driver. The other thing i noticed was if i changed the driver to thin in my connectString (jdbc:oracle:thin:@sridb:1521:intpl) it works fine.

 

Has anyone encountered this similar issue. Any help in this is appreciated.

 

In my jboss standalone.bat i set the classpath and path as

 

set CLASSPATH=%CLASSPATH%;C:\ple\instantclient\ojdbc6.jar

set PATH=C:\ple\instantclient;%PATH%

 

In modules folder i created com/myoracle/main folders and copied into it the C:\ple\instantclient\ojdbc6.jar

also created a dlls folder under main and copied all the dlls from C:\ple\instantclient

 

This is how my module.xml looks like

 

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.0" name="com.myoracle">

    <resources>

      <resource-root path="dlls"/>

        <resource-root path="ojdbc6.jar"/>

    </resources>

    <dependencies>

        <module name="javax.api"/>

        <module name="javax.transaction.api"/>

    </dependencies>

</module>

 

In my test.war/WEB-INF this is my jboss-deployment-structure.xml

 

<jboss-deployment-structure>

    <deployment>

        <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->

        <exclusions>

           

        </exclusions>   

       

        <dependencies>

                                <module name="com.myoracle" />

                    </dependencies> 

    </deployment>

</jboss-deployment-structure>

 

I also tried it with giving a datasource in standalone.xml l and accessing it in my jsp with the datasource name. But get the same issue. It works only if i use thin but not oci.

<subsystem xmlns="urn:jboss:domain:datasources:1.0">

            <datasources>

                <datasource jta="true" jndi-name="java:/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">

                    <connection-url>jdbc:oracle:oci:@sdqa11:1521:intpl</connection-url>

                    <driver>plejdbc</driver>

                    <security>

                        <user-name>nielsen_claritas</user-name>

                        <password>f00sball</password>

                    </security>

                </datasource>

                <drivers>

                    <driver name="plejdbc" module="com.nielsen.oraclejdbc">

                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                    </driver>

                </drivers>

            </datasources>

        </subsystem>

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community