Section 4.7. Database Checklist


4.7. Database Checklist

OK, so here's the checklist of things we've accomplished so far:

  • Stored the JDBC driver in $JBOSS_HOME/server/default/lib (hsqldb.jar)

  • Configured the database deployment descriptor in $JBOSS_HOME/server/default/deploy (hsqldb-ds.xml) Among other things, this is where we set up the JBoss JNDI name (java:/JBossAtWorkDS).

  • We created a global JNDI reference to the DataSource in jboss-web.xml. This name matches the name in the database deployment descriptor. We also provided a setting that maps the global JNDI name to a local JNDI name using ENC-style naming (java:comp/env/jdbc/JBossAtWorkDS).

  • We created a local JNDI reference to the DataStore in web.xml..

  • We created a ServiceLocator class that encapsulates our JNDI lookup and returns the DataSource.

Because of the way we've set things up, switching databases at this point is relatively easy. For example, if you'd prefer to work against an instance of MySQL, we only need to copy the JDBC drivers to the $JBOSS_HOME/server/default/lib directory and copy a new database deployment descriptor into the deploy directory. If you use the same JNDI name that we already used, your job is doneall the code upstream will be configured and ready to hit the new database.

We've said it many times before, but it's worth saying again: Hypersonic is a great database for our immediate purposes because it doesn't require configuring an external resource. However, in a production environment, we'd most likely use a more robust database.

We are now ready to create a Car table and insert some sample data.



JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net