Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-05-2007, 02:59 PM
Member
 
Join Date: Nov 2007
Posts: 2
daheri is on a distinguished road
Loading a connectionpool with IIS-servletexec
Hi,

I have a web-application running servlets using ServletExec and IIS on a windows computer.

I also have a connectionpool (primrose) to provide me with connections to the database.

My question is when and how do you best load the connectionpool?

At the current time I have a class called DBBroker who handles the connections. This class has three methods (getConnection, closeConnection and loadPool). getConnection returns a connection from the pool and an exception is thrown is the pool is not loaded. closeConnection returns the connection to the pool. loadPool creates the pool.

Each time a servlet is run i need to do this:
DBBroker dbb = new DBBroker();
Connection conn = dbb.getConnection();
//do db-things
dbb.closeConnection(conn);

The problem is ofcourse that the connectionPool is not loaded the first time I start up my application. So I basicly have a try-catch within the getConnection method and if a catch appears then the loadPool() method is runned. This causes the application to get an error the first time a servlet is called and the next times it works perfectly. So to work around this i added in the catch in the getConnection() method below the loadPool line a new attempt to get the connection. This makes everything work perfectly.

But despite that everything do work it feels like a weird way to do it.

Is it a way to get the loadPool() method to be run when you start the IIS? Or is there another smart way to load the pool without doing try-catches to see if it already has been loaded?

Thanks in advance for all your helpfull answers!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem loading resources. jimm1 Advanced Java 6 06-23-2008 09:31 PM
Loading Images - Imp Thulasiraman Advanced Java 0 01-28-2008 11:33 AM
Loading An Image Help Please! shaungoater Java 2D 2 01-09-2008 10:14 AM
Help Loading Up Pictures marco Java Applets 3 08-15-2007 12:32 AM


All times are GMT +3. The time now is 10:52 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org