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]

Reply via email to