Original Source

Glen has been busy updating groovyblogs.org to the latest Grails 1.0.3 release. He also took this opportunity to update some features and rework the site to accommodate messaging (JMS). Now he writes about his experience setting up JNDI datasources.

Today I’ve moved a bunch of my Grails apps over to JNDI Data Sources, and while it’s fresh in my mind, I thought I’d document a few of the tips and tricks involved.

First of all, why would you even want to use JNDI data sources? A few good reasons:

  • Most importantly, your app server can probably manage your database connections a lot better than you can
  • You don’t have to embed your username/password data in config files, and then end up committing them to public repos (this has led to several password changes for me in the past… the shame!)
  • Developers can call their local databases whatever they want (and they can be whatever type of database server they like) - just map the JNDI reference to whichever server and database floats your boat.
  • Does away with the need to ship db-specific drivers with your app (well.. in theory.. if you’re using Jetty for your DEV work , this may well not be true)

Glen shows portions of his configuration files, while at the same time giving a valuable warning: setting JNDI datasources with embedded Jetty on the development environment requires different settings compared to the production environment. He then proceeds to explain what to change between production environments.

Tags: ,



One Comment to “Grails, Jetty, Glassfish and JNDI Data Sources (Glen Smith)”

  1. Database Management » Blog Archive » Grails, Jetty, Glassfish and JNDI Data Sources (Glen Smith) | July 24th, 2008 at 12:57 pm

    […] noble musings wrote an interesting post today onHere’s a quick excerpt Original Source Glen has been busy updating groovyblogs.org to the latest Grails 1.0.3 release. He also took this opportunity to update some features and rework the site to accommodate messaging (JMS). Now he writes about his experience setting up JNDI datasources. Today I’ve moved a bunch of my Grails apps over to JNDI Data Sources, and while it’s fresh in my mind, I thought I’d document a few of the tips and tricks involved. First of all, why would you even want to use JNDI data sources? A […]

Leave a Comment