I'm using MySQL rather than Oracle...
------------------Struts-congif.xml---------------------------------
<struts-config>
<data-sources>
<data-source description="MySQL-test"
driverClass="org.gjt.mm.mysql.Driver"
url="jdbc:mysql://localhost/test"
password=""
user=""
autoCommit="true"
maxCount="4"
minCount="2" />
</data-sources>
</struts-config>
------------------Action-------------------------------------------
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
nextAction = "success";
// Create Database connection
Connection connection = null;
// Insert Build Program Items
try {
DataSource dataSource =
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY)
;
connection = dataSource.getConnection();
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("SELECT * FROM orders");
}
}
catch (SQLException sqle) {
// Log exception and post error message
servlet.log("ActionDB-SQL Exception: ", sqle);
nextAction = "error";
}
finally {
try {
if (connection != null) {
connection.close();
}
}
catch (SQLException sqle) {
servlet.log("ActionDB-SQL Exception Closing Connection: ", sqle );
}
// Forward control to the specifiedURI
return (mapping.findForward(nextAction));
}
}
-----Original Message-----
From: Dinu Jose [mailto:[EMAIL PROTECTED]]
Sent: 09 May 2001 19:38
To: '[EMAIL PROTECTED]'
Subject: ConnectionPooling in struts
Hi All,
Could somebody help me in solving this issue.
I need an example of connection pooling in struts.
I had to use the oracle thin driver
The files needed are:
i) struts-config.xml
ii) java class
I want to know how I must write the datasource part in
struts-config.xml.
and the java class which extends the Action class.
I have tried the example given in the struts site ,but didn't
succeed.
and it is not fully given.
Waiting for your help.
thanks in advance
Dinu