• 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

[struts] using custom DB connection pool

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I have been using a connection pool manager for my applications for a long time and it works fine. So now, I need to export its functionality to struts-way-of-doing-things.
My DBConnectionManager takes its properties (user, pass, URL, maxConn, minConn, ...) from a db.properties file. Migrating to struts-way I've seen that all that properties are specified in the <data-source> tag.
Ok. Now come my questions:
1.- the <data-source> tag has a "key" attribute. How can I reach it? I mean, once I give a name to that pool in the struts-config.xml file (I undertand this will be the name of my pool), I need to reference it somehow in my application to create a release() method that let me to empty the pool.
2.- the className attribute of the <data-source> tag makes me to create a extended DataSourceConfig class. Do I really need to create another class? is the properties field not enough? the class has the addProperty() method (which I don't know where to use)...
3.- I understand that I have to access that class extending DataSourceConfig from my ActionServlet, but I don't have the faintest idea of how to do it...
4.- Finally, I understand the type attribute is the one that references my DBConnectionManager. Do I have to change my class, making it an implementation of javax.sql.dataSource? Originally my class was a singlenton in the common package. If I need two or more applications accessing it, can it still be a singleton? or would two distinct applications accessing the same singleton class interfere with eachother?
Thanks a lot..
Nacho
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nacho,
Me too am thinking about how to implement connection pooling in struts.
Here is a sample website and an article by Tim Holloway who participates here. He uses a database.

sample site: http://www.mousetech.com/strutdemo/index.jsp
article:
http://www.fawcette.com/javapro/2002_04/magazine/features/tholloway/
Axel
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
don't like the way to hardcoded the database username and password in a text file.Any example to show how to use input data to connect to the backend database in struts?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic