- JBoss needs to know where the Oracle jdbc driver classes are located. This can be done by either, copying the Oracle jdbc archive file to the server default lib folder. Search and locate the ojdbc6.jar file in the Oracle \jdbc\lib folder. Copy the ojdbc6.jar file to the JBoss \server\default\lib folder.
- Define a datasource in JBOSS to access a specific Oracle database instance. Copy the /docs/examples/jca/oracle-ds.xml file from the jboss directory to the /server/default/deployfolder in JBoss. Open a text editor (e.g., WordPad or xCode) and modify the file as follows.
- Assign an unique name to the data source being defined in this XML file by changing the value of the <jndi-name> tag (e.g., CIT460DS).
- Change the dbmsServerIpAddress in the <connection-url> tag to the IP address of your Oracle database server (e.g., 127.0.0.1).
- Change yourDBSidName to the Oracle SID name for your database (e.g., HTB).
- Change the value of the yourUserName in the <user-name> tag to your Oracle schema (user name).
- Change the value of the <password> tag to the password for your database schema.
<?xml version=”1.0″ encoding=”UTF-8″?>
<!– ======================–>
<!– Datasource config for Oracle –>
<!– ====================== –>
<datasources>
<local-tx-datasource>
<jndi-name>yourDSName</jndi-name>
<connection-url>jdbc:oracle:thin:@dbmsServerIpAddress:1521:yourDBSidName</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>yourUserName</user-name>
<password>yourPassword</password>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
- Modify the standardjbosscmp-jdbc.xml configuration file in the JBoss /server/default/conf folder. This file defines the default data source to JBoss and defines the data type mappings for the different types of databases systems. Change the value of the <datasource> tag below to the data source name you defined in the <jndi-name> tag in the oracle-ds.xml file you modified above (e.g., CIT460DS). If you search down the file for the value, Oracle9i, you will see the Oracle data type mappings for the corresponding java data types. <?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE jbosscmp-jdbc PUBLIC “-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN” “http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd”>
<!– ================================ –>
<!– Standard JBossCMP-JDBC Configuration –>
<!– ================================ –>
<jbosscmp-jdbc>
<defaults>
<datasource>java:/YourDSName</datasource>
…
…
</defaults>
…
</jbosscmp-jdbc>