• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

locations of jdbc drivers and jdbc code in j2ee web application

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the best place to put jdbc database drivers in a web application (e.g. Tomcat)?

Our present server environment is a bit Balkanized--so my inclination is to but the driver jars within Tomcat. But, if so, where within Tomcat? If you think it is a bad idea to put the driver jars within Tomcat, I would like to know.

And how about jdbc database access code? This, I assume, would be put in its own package under WEB-INF/classes/myPackageName, but was not sure. I will be writing my own for now, instead of using iBatis, Hiburnate, etc.


Many thanks in advance!
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Benjamin Weaver:
Where is the best place to put jdbc database drivers in a web application (e.g. Tomcat)?

Our present server environment is a bit Balkanized--so my inclination is to but the driver jars within Tomcat. But, if so, where within Tomcat? If you think it is a bad idea to put the driver jars within Tomcat, I would like to know.


Are you using datasources that will be shared across applications or specific to your application?


And how about jdbc database access code? This, I assume, would be put in its own package under WEB-INF/classes/myPackageName, but was not sure. I will be writing my own for now, instead of using iBatis, Hiburnate, etc.


Yes. That is a good location. If your application gets more complicated you may consider developing the JDBC code in a separate project and jar'ing up that project. Then the jar would go under your WEB-INF/lib directory.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is good possibility that datasources will eventually be shared by several applications.
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Benjamin Weaver:
There is good possibility that datasources will eventually be shared by several applications.


In that case, I would favor putting the drivers in a separate directory. For example, /apps/databaseName/driver. This protects you against change to individual apps and Tomcat upgrades.

(If it was only one app, I would have suggested using the application's lib directory.)
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This makes good common sense. Thanks, Jeanne.
 
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic