commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Wasserman" <>
Subject [newbie]DBCP with Struts
Date Wed, 26 Mar 2003 13:04:29 GMT
I am now building a DAO (thanks for putting me on the right track Mr.
Graham) and I'm trying to find a way for the DAO to establish it's own
connection to the database pool/s created by the ActionServlet. Again, I
must stress that I am very new to struts and dbcp.  I would prefer not
to pre-established connection (using getConnection) and passing that to
the DAO, and I believe the method I'm trying to use below should be
helpful in a lot of other circumstances as well.
Note: If anyone has the perfect solution for a data strategy for
multiple companies using the same struts app, please advise!
I know that would be very easy if my pool/s where configured in
server.xml and then would be accessable through initialContext.  But
being configured in strust-config (servlet context) I cannot set up a
<resource-ref> for it in web.xml.  (in servlet and not container
context, because multiple companies share the same web-server, but have
their own app connecting to their unique db instance).
So I tried to get the running instance of the action servlet by using
Class.forName() but that doesn't work (if someone could tell me why I'd
appreciate it) Now I'm trying to access the pool by using the following:
Data Source configured in struts-config (some class paths shortened for
<data-source type="org....BasicDataSource" key="logindb">
  <set-property property="driverClassName"
  ...other properties...
  <set-property property="url"
  ..more properties..
...more datasources...
Now I'm trying to "find" the pool in the following way:
GenericObjectPool cnnPool new GenericObjectPool(null); PoolingDriver
pooldr = new PoolingDriver(); Pooldr.registerPool("logindb", cnnPool);
Connection cnn =
I get the following error:
Javax.servlet.ServletException: No pool found for
Could anyone help?
Thanks in advance.
Johan Wasserman.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message