25.6.2. Database Connection

Database performance tuning involves changing the initial database conceptual schema to improve performance. Irrespective of type, overall database management system performance tuning involves effective and efficient use of your hardware (hard disk, CPU and RAM) and improving database reads and writes.
Resource limits set by your operating system may also set limits on your database management system. A database administrator can analyze a database and identify performance bottlenecks by taking the above factors into consideration and adjusting the necessary database management system parameters such as writing dirty buffers to disk, checkpoints and log file rotations. In some instances hardware upgrades may also be necessary to improve database performance.
Database connections can be costly to establish and manage. Applications that create new connections to the database with every transaction or query and then close that connection add a great deal of overhead. Having a very small connection pool will also throttle the applications as the JBoss Enterprise Web Platform by default queues the request for a default of 30,000 milliseconds (30 seconds) before cancellation and throwing an exception.
We recommend reliance on data source definitions you can setup in the deploy directory of the JBoss Enterprise Web Platform and utilizing the connection pool settings. Connection pooling in the JBoss Enterprise Web Platform allows you to easily monitor your connection usage from the JMX console to determine proper sizing. Your database management system may also shipped with tools that allow you to monitor connections.
Depending on the databases implemented, please ensure you create a data source file in the deploy directory of your configuration as shown below:
$JBOSS_HOME/server/$PROFILE/deploy/
The filename should be of the form $DATABASE_NAME-ds.xml.

Note

Please note that the name of the file must end with -ds.xml in order for the JBoss Enterprise Web Platform to recognize it as a data source file. The PostgreSQL database data source file for example is named postgres-ds.xml.

Examples

Examples of datasource definition files for external databases can be found in the $JBOSS_HOME/docs/examples/jca directory.