struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Leja" <Martin.L...@mpluss.de>
Subject statement pooling, howto utilize in struts
Date Wed, 26 Mar 2003 11:19:57 GMT
hi,

the struts docs suggest the usage of org.apache.commons.dbcp.BasicDataSource
as data-source which supports connection pooling.

I am also interested in statement pooling support, but i didn't find any
useful hints about it. Commons/dbcp only provides examples and api docs
which i cannot learn from if BasicDataSource supports statement pooling.
Searching the struts user mailing list archive didn't help neither.

I then came across the jdbc 3.0 api specification at
http://java.sun.com/products/jdbc/download.html.
In this document it's described how a data-source implementaion can be
tested whether it supports the wanted feature.

I gave it a try, configured a mysql/BasicDataSource in struts-config.xml and
run the following action:
public ActionForward execute(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response
  )
  throws Exception
  {
    javax.sql.DataSource dat;
    java.sql.Connection con= null;
    try {
      dat= getDataSource(request);
      con= dat.getConnection();

      java.sql.DatabaseMetaData meta= con.getMetaData();
      System.out.println( "supportsStatementPooling: "
        + meta.supportsStatementPooling() );
    } catch (java.sql.SQLException sqle) {
      getServlet().log("Connection.process", sqle);
    } finally {
      try {
        con.close();
      } catch (java.sql.SQLException e) {
        getServlet().log("Connection.close", e);
	}
    }
  return ( mapping.findForward("welcome") );
}


meta.supportsStatementPooling() returns false in this case. Is there a
data-source implementaion which supports this feature and works with struts?
I believe that there is to litte info on this subject. Can someone point me
to the right location where i can read more about it?

--
Regards, martin.leja@mpluss.de



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message