O'Reilly logo

Enterprise JavaBeans 3.0, 5th Edition by Bill Burke, Richard Monson-Haefel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. JBoss Database Configuration

This appendix describes how to set up database pools for data sources other than the default database embedded in JBoss, Hypersonic SQL. It also shows you how to set up your EJBs and entity beans to use these database pools. For illustration purposes, we've modified Exercise 4.1 in Workbook 2 to configure and use an Oracle connection pool with JBoss.

Set Up the Database

To deploy a database connection pool, JBoss requires a data pool configuration file. The configuration file is very simple, yet you can use it for almost all standard data pool setups.

Basic Setup

The first step is to download the JDBC driver classes for your database. Copy your database's JDBC JAR file to $JBOSS_HOME/server/default/lib. For example, the Oracle JDBC class files are contained in classes12.zip.

The JBoss distribution includes example database connection-pool files in the directory $JBOSS_HOME/docs/examples/jca. The name of each file ends in -ds.xml. For this exercise, we've copied the oracle-ds.xml configuration file to exAppendixA/titandb-ds.xml and modified it accordingly.

To deploy this connection pool, you must copy titandb-ds.xml to the $JBOSS_HOME/service/default/deploy directory. Note that the name of this config file must end with -ds.xml, or JBoss will not deploy it.

Tip

Database connection pools are among the many things that can be hot-deployed in JBoss, simply by dropping the pool's XML configuration file into the deploy directory.

Examine some of the configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required