Hi John,

With struts connection pools, you need to configure the connection pool
section of the struts-config.xml file. Note that the data source config in
the web.xml file only tells the container that the servlet context needs
access to the referenced data sources -- it doesn't actually tell how to
construct those sources!

The struts example web app contains a struts-config.xml with DB data
sources, I believe.

Regards,
Ben Flaumenhaft
Principal, Sidelight Consulting
http://www.sidelight.com


----- Original Message -----
From: "John de la Garza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 06, 2001 10:52 AM
Subject: struts question??


> I really need an answer...please if you know, respond.  I feel like the
> invisible man!
>
> I am using this sample code from the struts users guide...with a
> problem...there is no findDataSource() method.
>
>
> All I want to do is define a datasource in the context of my servlet
> container...should this be hard?  I tried using the stuff from the servlet
> 2.2 spec <resource-ref> but it doesn't work!
>
>
> What is going on?
>
> -----------------------------------------------
> public ActionForward
>        perform(ActionMapping mapping,
>                ActionForm form,
>                HttpServletRequest request,
>                HttpServletResponse response)
> {
>  try {
>    javax.sql.DataSource dataSource =
>      servlet.findDataSource(null);
>    java.sql.Connection myConnection =
>      dataSource.getConnection();
>
>    //do what you wish with myConnection
>  } catch (SQLException sqle) {
>    getServlet().log("Connection.process", sqle);
>  } finally {
>
>    //enclose this in a finally block to make
>    //sure the connection is closed
>    try {
>      myConnection.close();
>    } catch (SQLException e) {
>      getServlet().log("Connection.close", e);
>    }
>  }
> }
> -----------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to