aspose file tools*
The moose likes JDBC and the fly likes locations of jdbc drivers and jdbc code in j2ee web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "locations of jdbc drivers and jdbc code in j2ee web application" Watch "locations of jdbc drivers and jdbc code in j2ee web application" New topic
Author

locations of jdbc drivers and jdbc code in j2ee web application

Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
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!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
There is good possibility that datasources will eventually be shared by several applications.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

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

Joined: Apr 08, 2003
Posts: 161
This makes good common sense. Thanks, Jeanne.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: locations of jdbc drivers and jdbc code in j2ee web application