Reputation: 1661
I looked over the Internet but I couldn't find any easy tutorials or docs explaining the problem.
I want to connect my JBoss 7.1.1 Final to Oracle Database. I am using Oracle Database 11g Express Edition on 64bit Windows.
The question is what should I do to connect my jboss to Oracle DB?
Upvotes: 1
Views: 7447
Reputation: 327
You can create JNDI in Jboss 7.1.1 as below and configure mybatis to use this JNDI. make sure you have oracle driver in Modules
at com.oracle.ojdbc
localtion.
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/test" pool-name="test" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:@localhost:1521:testDB</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>false</prefill>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Upvotes: 1
Reputation: 3500
Check this answer jboss 7 oracle datasource configuration
In short, you have to declare a jboss module for your oracle driver. Then, you create your datasource in standalone-xxx.xml and add the reference to the driver.
Finally, you can use this datasource in any persistence.xml by using the jndi-name declared in the datasource.
All of this is explained in the url provided.
Good luck!
Upvotes: 1