2 Replies Latest reply on Jul 14, 2011 2:22 PM by hostalp

    JDBC driver installation and configuration - few questions

    hostalp

      Hello,

       

      1.

      I see you recommend to just deploy any JDBC driver and then reference to it from datasource configuration.

      That's ok as long as the JDBC driver stuff consists of just one jar, but how about multiple jars (I need two actually - Oracle ojdbc6.jar and optional orai18n.jar for additional charset support etc)?

      I'm currently using the "module" method which is pretty decent, however given that the recommended way is "deploy" - is there a way for deploying both required JDBC driver jars somehow (and thus let them see classes from each other)?

      I mean without the need to mess up with the jar internal manifests to add dependencies etc - just some really simple method without messing up with jars themselves.

       

      2.

      Let's assume I use the "module" method. Then after the module package is prepared I need to register it as JDBC driver - now I can do it via editing standalone.xml or domain.xml.

      Is there a way to do this via CLI?

      I can add or remove datasource (add-data-source etc)

       

      However I don't see an option for adding the JDBC driver definition.

      I can list any (/subsystem=datasources:installed-drivers-list), but that seems to be everything.

      There's something like /subsystem=datasources:write-attribute but I'm not sure if it can be used for that and if so, then how?

        • 1. Re: JDBC driver installation and configuration - few questions
          jaikiran

          Petr H wrote:

           

          Hello,

           

          1.

          I see you recommend to just deploy any JDBC driver and then reference to it from datasource configuration.

          That's ok as long as the JDBC driver stuff consists of just one jar, but how about multiple jars (I need two actually - Oracle ojdbc6.jar and optional orai18n.jar for additional charset support etc)?

          I'm currently using the "module" method which is pretty decent, however given that the recommended way is "deploy" - is there a way for deploying both required JDBC driver jars somehow (and thus let them see classes from each other)?

          I mean without the need to mess up with the jar internal manifests to add dependencies etc - just some really simple method without messing up with jars themselves.

           

          You can package the optional orai18n.jar within the application (for example in the .war/WEB-INF/lib or .ear/lib).

           

           

          Petr H wrote:

           

          2.

          Let's assume I use the "module" method. Then after the module package is prepared I need to register it as JDBC driver - now I can do it via editing standalone.xml or domain.xml.

          Is there a way to do this via CLI?

          I can add or remove datasource (add-data-source etc)

           

          However I don't see an option for adding the JDBC driver definition.

          I think, that's currently not yet supported via CLI http://lists.jboss.org/pipermail/jboss-as7-dev/2011-June/002323.html. Alexey would know for sure.

          • 2. Re: JDBC driver installation and configuration - few questions
            hostalp

            It turns out that the module I created doesn't work properly

             

            module

            modules/oracle/jdbc/main/ojdbc6.jar

            modules/oracle/jdbc/main/orai18n.jar

            modules/oracle/jdbc/main/module.xml

             

            Oracle JDBC Driver version is 11.2.0.2.0

             

            module.xml

             

            <module xmlns="urn:jboss:module:1.0" name="oracle.jdbc">
              <resources>
                <resource-root path="ojdbc6.jar"/>
                <resource-root path="orai18n.jar"/>
              </resources>
              <dependencies>
                <module name="javax.api"/>
                <module name="javax.transaction.api"/>
              </dependencies>
            </module>
            

             

            And datasource and driver config:

             

                       <datasources>
                            <datasource jndi-name="jdbc/appds" pool-name="appds" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                                <connection-url>
                                    jdbc:oracle:thin:@host:1521:db
                                </connection-url>
                                <driver>
                                    oracle-jdbc
                                </driver>
                                <pool>
                                    <min-pool-size>
                                        0
                                    </min-pool-size>
                                    <max-pool-size>
                                        10
                                    </max-pool-size>
                                    <prefill>
                                        false
                                    </prefill>
                                    <use-strict-min>
                                        false
                                    </use-strict-min>
                                    <flush-strategy>
                                        FailingConnectionOnly
                                    </flush-strategy>
                                </pool>
                                <security>
                                    <user-name>
                                        USER
                                    </user-name>
                                    <password>
                                        PASSWORD
                                    </password>
                                </security>
                                <validation>
                                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
                                    <validate-on-match>
                                        false
                                    </validate-on-match>
                                    <background-validation>
                                        false
                                    </background-validation>
                                    <useFastFail>
                                        false
                                    </useFastFail>
                                    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
                                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
                                </validation>
                                <timeout>
                                    <blocking-timeout-millis>
                                        30000
                                    </blocking-timeout-millis>
                                    <idle-timeout-minutes>
                                        30
                                    </idle-timeout-minutes>
                                    <set-tx-query-timeout/>
                                    <query-timeout>
                                        120
                                    </query-timeout>
                                    <use-try-lock>
                                        60
                                    </use-try-lock>
                                </timeout>
                                <statement>
                                    <track-statements>
                                        NOWARN
                                    </track-statements>
                                    <prepared-statement-cache-size>
                                        10
                                    </prepared-statement-cache-size>
                                    <share-prepared-statements/>
                                </statement>
                            </datasource>
                            <drivers>
                                <driver name="oracle-jdbc" module="oracle.jdbc">
                                    <xa-datasource-class>
                                        oracle.jdbc.xa.client.OracleXADataSource
                                    </xa-datasource-class>
                                </driver>
                            </drivers>
                        </datasources>
            
            

             

             

            And while it works with just ojdbc6.jar, when I enable (uncomment in module.xml) orai18n.jar I start getting

             

            javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/appds

            at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:394)

            at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:367)

            at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:467)

            at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

            ... 53 more

            Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null

            at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:346)

            at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:392)

            at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:357)

            at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:351)

            ... 56 more

            Caused by: javax.resource.ResourceException: Could not create connection

            at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:241)

            at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:209)

            at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:694)

            at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:319)

            ... 59 more

            Caused by: java.lang.NoClassDefFoundError: Could not initialize class oracle.sql.CharacterSet

            at oracle.jdbc.driver.DBConversion.init(DBConversion.java:169)

            at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:120)

            at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1087)

            at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)

            at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)

            at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)

            at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)

            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)

            at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:221)

            ... 62 more

             

            When I put contents of both jars together into one it works, but with those two separate it just doesn't. Any idea what might be wrong?