Create JNDI – Data source in JBoss:
Step1:
ü Create a
folder structure Path: JBOSS_HOME\modules\system\layers\base\com\oracle\jdbc\main
ü Copy oracle
driver jar to this folder
ü Create
module.xml as below
<?xml version="1.0"
encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1"
name="com.oracle.jdbc">
<resources>
<resource-root path="oraclejdbc-11.2.0.4.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api"
optional="true"/>
</dependencies>
</module>
Step 2: configure data source in standalone:
ü JBOSS_HOME\standalone\configuration\standalone.xml
and the below code under the <subsystem xmlns="urn:jboss:domain:datasources:1.1">
tag.
<datasource jta="false"
jndi-name="java:jboss/jdbc/OracleDSJNDI" pool-name="ORACLE"
enabled="true" use-ccm="false">
<connection-url>jdbc:oracle:thin:@192.168.74.98:1521:coredb</connection-url>
<driver>OracleJDBCDriver</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>300</max-pool-size>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>BLDPOS_QA</user-name>
<password>bluedart</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<idle-timeout-minutes>100</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>nowarn</track-statements>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
ü
Add driver configuration under the
<drivers> as below
<driver
name="OracleJDBCDriver" module="com.oracle.jdbc">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
Step 3: Star/Re-start your server to effect
these changes
Ø If you want
to reconfigure connection pool navigate to pool tab à click Edit à save the changes and restart the
server
Accessing – in Application:
Step1: Integrate your spring + hibernate
with JNDI configured in jboss by changing your database configuration like
below
No comments:
Post a Comment