[jboss-user] [Datasource Configuration] - Re: JBoss 7 multiple data source declarations for multiple applications

Kelly Dolan do-not-reply at jboss.com
Fri May 18 15:10:58 EDT 2012


Kelly Dolan [https://community.jboss.org/people/kdolan1] created the discussion

"Re: JBoss 7 multiple data source declarations for multiple applications"

To view the discussion, visit: https://community.jboss.org/message/736575#736575

--------------------------------------------------------------
Ok, I hear you so I spent most of today removing my -ds.xml files and trying to use the CLI to create my data source.  I'm having a horrible experience and still do not have anything working.  Can you see what I'm doing wrong?

My CLI Command

At a command prompt I'm executing the following:

jboss-cli.bat --connect controller=myserver:myport --file=mycmds.cli

The "mycmds.cli" file contains the following:

xa-data-source add --name=MyDB --jndi-name=java:jboss/datasources/MyDB --user-name=myName --password=myPassword --driver-name=oracle.jdbc.driver.OracleDriver --xa-datasource-class=oracle.jdbc.xa.client.OracleXADataSource --same-rm-override=false --no-tx-separate-pool=true --check-valid-connection-sql="select count(*) from MYTABLE"

My original -ds.xml file (from JBoss 4.x) I'm trying to convert to JBoss 7.x contained the following:

  <xa-datasource>
    <jndi-name>MyDB</jndi-name>
    <track-connection-by-tx>true</track-connection-by-tx>
    <isSameRM-override-value>false</isSameRM-override-value>
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
          <!-- The line below is used only for mysql installations.  --> 
          <!--new-connection-sql>set autocommit=1</new-connection-sql-->
    <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:XE</xa-datasource-property>
    <xa-datasource-property name="User">myUser</xa-datasource-property>
    <xa-datasource-property name="Password">myPassword</xa-datasource-property>
    <no-tx-separate-pools />
    <check-valid-connection-sql>select count(*) from MYTABLE</check-valid-connection-sql>
  </xa-datasource>

 Oracle driver (ojdbc14.jar)

I first deployed this as a regular JAR by copying it to the standalone/deployments folder and added a .dodeploy file.  It deployed successfully but when I ran my CLI command above, it said "oracle.jdbc.driver.OracleDriver" not installed.

I then tried adding to the jar the java.sql.Driver file (as described in the JBoss documentation) to the JAR thinking this might be the problem.  It redeployed successfully but I still received the CLI error message.

Finally, I undeployed the Oracle driver as a regular JAR and added it as a module.  I created a modules/oracle/jdbc/main folder, copied the original JAR into this folder and added a module.xml file.  The module.xml file contains

<module xmlns="urn:jboss:module:1.1" name="oracle.jdbc">
        <resources>
                <resource-root path="ojdbc14.jar"/>
        </resources>
        <dependencies>
                <module name="javax.api"/>
        </dependencies>
</module>

I restarted JBoss, retried my CLI command and received the same error message.  I also tried changing the driver name from "oracle.jdbc.driver.OracleDriver" to "oracle.jdbc" and "ojdbc14.jar".  In both cases, I still receive the CLI error message "XXX is not installed".

Ultimately, I'm fine setting up Oracle as a module (vs. deployment) because I must also support MySQL and I found in the JBoss documentation it must be configured as a module because it's "is jdbc compliant" method always returns false or something like that.  Since I must configure that as a module, I might as well be consistent w/ Oracle.

Thanks!
Kelly
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/736575#736575]

Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120518/2dc82610/attachment.html 


More information about the jboss-user mailing list