You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gilson Nascimento D Elrei <gi...@cpm.com.br> on 2002/03/28 19:53:57 UTC
error compiling source code bean
I'm trying to implement this piece of code extracted from
http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_model.html#dat
abases
but i'm receiving some errors.
Which packages i have to import in my source bean ?
thanks in advance.
Gilson
<-- from struts documentation --->
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>