Results 1 to 2 of 2

Thread: Difference between JNDI datasource & DriverManagerDataSo

  1. #1
    Join Date
    Jan 2005
    Posts
    3

    Default Difference between JNDI datasource & DriverManagerDataSo

    Does anyone know what is the recommended way to configure a datasource? Should you configure it in your app server (Tomcat, WebLogic) and access though JNDI or just use Spring's DriverManagerDataSource and configure the data source in your Spring config file?

    What are the differences between the two? I was wondering if only the app server method would utilize connection pooling.

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    If you're using distributed transactions you need to use a container JTA datasource. This means a full-blown J2EE server like WebLogic, rather than a web container like Tomcat, unless you combine the web container with a transaction coordinator like JOTM.

    However, most applications don't need distributed transactions. In that case there's no great advantage in using a container data source besides having a server-wide configuration.

    Spring is designed to make the choice transparent, so it's equally at home in either scenario.

    However, DriverManagerDataSource is not a solution for production apps--just a convenience for testing. Sure, app servers have connection pools, but there are also plenty of standalone connection pools such as Apache Commons DBCP. You should always use a connection pool in your application.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Replies: 7
    Last Post: Aug 29th, 2011, 05:01 AM
  2. Replies: 13
    Last Post: Feb 5th, 2010, 12:31 AM
  3. JBoss DataSource not found
    By moacsjr in forum Data
    Replies: 10
    Last Post: Aug 25th, 2005, 01:26 PM
  4. Replies: 1
    Last Post: Feb 12th, 2005, 07:30 AM
  5. Ignoring missing Jndi DataSource within IDE?
    By Bill Pearce in forum Container
    Replies: 2
    Last Post: Oct 27th, 2004, 09:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •