The configuration file that will be generated for JBOSS EAR is called Shark.conf.in and is located in <shark_install_dir>/tws/.dist/EJB/conf/jboss directory (or in <shark_install_dir>/tws/.dist/EJB/conf/jboss-ws directory for EAR with beans that can be exposed as web services). The parameters specific for JBOSS are set to the following values:
DatabaseManager.defaults.XATransactionManagerLookupName=java:/TransactionManager SharkTxSynchronizationFactory.XATransactionManagerLookupName=java:/TransactionManager DatabaseManager.DB.sharkdb.Connection.DataSourceName=jndi:java:sharkdb
The parameter DataSourceName has the following form: "jndi:java:<jndi name of the database defined in JBOSS >". In this example, jndi name is sharkdb.
The JBOSS standard for file name which defines database is: <jndi_name>-ds.xml.
The property file describing the database is called sharkdb-ds.xml.in and is located in <shark_install_dir>/tws/.dist/EJB/conf/jboss directory (or in <shark_install_dir>/tws/.dist/EJB/conf/jboss-ws directory for EAR with beans that can be exposed as web services). During the EAR generation, this file will be generated for the database defined in configure.properties file under the name sharkdb-ds.xml. After generation, this file should be placed in JBOSS server's deploy directory.
Here is given the example for MySql database:
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>sharkdb</jndi-name> <connection-url>jdbc:mysql://localhost/shark</connection-url> <driver-class>org.gjt.mm.mysql.Driver</driver-class> <user-name>root</user-name> <password>sa</password> </local-tx-datasource> </datasources>
Database drivers, if not already added to JBoss, should be added in JBOSS server's lib directory.
When JBOSS is started, the database is automatically deployed into JBOSS (JBOSS server loads data source, related jdbc drivers, and registers the data sources into JNDI).