This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Struts and connectionPool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Struts and connectionPool" Watch "Struts and connectionPool" New topic

Struts and connectionPool

Servin Park

Joined: May 10, 2002
Posts: 26
Hello Ranchers,
I am building a webapp on top of struts. I also have a DBConnectionPool class that will handle getting MySQL database connection. I just want to ask your opinion on what I am doing has any flaw:
1. Extended ActionServlet and override init(...) method. In the init() I initialized conncetionpool and servletContext.setAttribute("dbpool", dbconn);
2. In the action class (for instance RegisterAction), I get the connectionpool like this. getServlet().getServletContext().getAttribute("dbpool");
I didn't get any problem having me as only user. Does anyone see flaws in my logic above? Do you have any better idea how to utilize generic connection pool with struts?
Thanks in advance for you kind replies.
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
there is a (development release) of JDBC3.0 driver for mySQL available.
sun jdbc im not sure if all the drivers include the pooling facility. best thing is to check with the mySQL homepage.
I agree. Here's the link:
subject: Struts and connectionPool
Similar Threads
using JDBC with EJB
Connecting to a db with a servlet or bean
custom tags (taglib)
How to share a user-connection between two projects
Accessing ServletContext attribute from Action Class.