• 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

Constant Connection Pooling inside Jar?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The goal of one project is to create a single jar that contains all of our data objects and sql commands for our 3 different databases and 4 webservice connections. This is going to be used in several applications - many of them rely on pieces of all three databases and some of the webservices. Our goal is to reduce all of this down to method calls where they just rely on the objects being returned. That way if we (finally) consolidate this data we just distribute a new jar to the applications and (hopefully) encounter no issues.

The big question for me is connection pooling. I don't want them to know anything about the databases they'll be connecting to, I want that all included in the jar. I don't want them to have to set up connection sources in tomcat, I'd like that all done in the jar. But can I set up some sort of persistent connection pool? Some applications have hundreds of users hitting them every few seconds while other applications have perhaps a dozen users per day. In the situations where it is only a handful of users it would be nice to have a connection pool ready so they do not encounter a delay getting a database connection.

I looked at some basic stuff

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html

But I'm not sure if it is possible to set up some sort of jar-aware persistence without SOME reference from the underlying application. Am I correct? Any suggestions on what I could do?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check if the license agreement of the software packages (pools, db drivers, ...) allows you to re-package or unjar/rejar their libraries.
 
Caden Whitaker
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the tip, I'll be careful... but I don't even have anything to go off this moment I'm looking for suggestions, and a good conn pooling jar friendly project would be a nice start
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat already has perfectly good connection pooling. What was your reason for rejecting it?
 
Caden Whitaker
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tomcat already has perfectly good connection pooling. What was your reason for rejecting it?



This may sound petty but I didn't want to have to manually keep track of the database information inside each instance of tomcat we have running.

Each instance of tomcat on our developer machines, development, pre-production, the production boxes. In my opinion that's a lot of room for error. Especially since we have multiple projects that shouldn't have to know where the data is coming from, they just need a simple way to access that data. I'd rather have all the DB info in a properties file inside the jar rather then having to put it on everyone's machine (and when we make changes to the db we have to replicate those changes).

The big reason for this is we are expecting a lot (A LOT) of data changes over the next couple of months. The entire removal of one database, the integration of two others, combinations, refactorings and the like are going to be a common issue for us. And I'd hate to have to tell the IT dept to make manual changes to reflect this.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also just place the context.xml with datasource settings in the META-INF of your webapp and Tomcat will pick it up.
Also see http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
reply
    Bookmark Topic Watch Topic
  • New Topic