Skip to main content

Databases with JBoss

Posted by ddevore on April 20, 2006 at 7:48 AM PDT

This is not a difficult topic but one which I needed to include to have a more complete JBoss enterprise setup.

Needed Information

JNDI Name

Connection URL

    Server Name

    Port

    Database Name

Driver Class

User Name

Password

The ???-ds.xml file

JBoss provides all kinds of ???-ds.xml files ready to be customized in the JBOSS_INSTALL/docs/examples/jca directory. There is one for just about every database you would ever need. For the most part they use the information mentioned above with some of them needing a little more. JBoss did a good job with giving descriptive names where the XML does not explicitly state what it is looking for. They all have the standard start of the Connection URL also such as jdbc:oracle:thin:@ for Oracle and jdbc:mysql:// for MySQL as well as the default port. So if you don't change the default port on the database all you need to do is change the Server Name, Database Name, Driver Class, User Name, and Password and in most cases the Driver Class will not need to be changed either. Once this information is correct put the ???-ds.xml file in the deploy directory for the server you need the Database connection on.

The Library

You will need to add the jar for the Database you are using in the lib directory for the server you need the Database connection on. This is in the

JBOSSS_INSTALL/server/SERVER_INSTANCE/lib directory.

Happy Connections

You should now have a connection to the Database you need.

Related Topics >>