JBoss 7 Datasource with MySql DB
Datasource Configuration in standalone.xml
We need to setup the datasource configuration in standalone.xml file in JBoss 7.The path of the standalone.xml file is /JBoss 7/standalone/configuration/standalone.xml
We need to setup of datasouce inside datasources tag in standalone.xml file.
Sample Datasource
<datasource jndi-name="java:/satyaDS01" pool-name="satyaDS01">
<connection-url>
jdbc:mysql://localhost:3306/SatyaDB
</connection-url>
<drivers>
<driver name="mysql" module="com.mysql">
</drivers>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>satay345</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql"/>
<xa-datasource-class>
driver name
<xa-datasource-class>
</driver>
</drivers>
Datasource Configuration in standalone.xml
We need to setup the datasource configuration in standalone.xml file in JBoss 7.The path of the standalone.xml file is /JBoss 7/standalone/configuration/standalone.xml
We need to setup of datasouce inside datasources tag in standalone.xml file.
Sample Datasource
<datasource jndi-name="java:/satyaDS01" pool-name="satyaDS01">
<connection-url>
jdbc:mysql://localhost:3306/SatyaDB
</connection-url>
<drivers>
<driver name="mysql" module="com.mysql">
</drivers>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>satay345</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql"/>
<xa-datasource-class>
driver name
<xa-datasource-class>
</driver>
</drivers>
Eclipse Configuration
Checkout the project from the SVN repository into a specific folder in you system.
Open the Eclipse IDE and import the project from the specified location. Imported the appropiate jar files in the build path of the Eclipse IDE.
Run the ANT file to generate the war file (satya.war) in your Build folder .
Copied the war file from the Build folder to deployment folder to the JBoss 7.
/JBoss 7/standalone/deployments
Start the JBoss server using below command
sh run.sh -b0.0.0.0 -c minimal
Access the URL using http://jboss server ip address:8080/satya
Finally getting your Application page.

No comments:
Post a Comment