Hello, I am confused on setting up a data source using dbcp with struts.
I am referencing this web-site: http://linux.com.hk/docs/struts/faqs/database.html I am using mysql and struts 1.2. The problem I have is two-fold. First I remember hearing something about the <data-sources> being depreciated? Not sure if I read that, or I heard it. Anyone know about this? Secondly, I have my configuration here in my struts-config.xml and all properties are filled out properly. But my action class that calls this, the datasource is NULL. Any ideas? Thanks, Struts-config <struts-config> <data-sources> <!-- configuration for commons BasicDataSource --> <data-source type="org.apache.commons.dbcp.BasicDataSource"> <set-property property="driverClassName" value="com.mysql.jdbc.Driver" /> <set-property property="url" value="jdbc:mysql://localhost:3306/fritest" /> <set-property property="username" value="javauser" /> <set-property property="password" value="javadude" /> <set-property property="maxActive" value="10" /> <set-property property="maxWait" value="5000" /> <set-property property="defaultAutoCommit" value="false" /> <set-property property="defaultReadOnly" value="false" /> <set-property property="validationQuery" value="SELECT COUNT(*) FROM testdata" /> </data-source> </data-sources> now my DispatchAction class has this AND IT PRINTS NULL ?? public final class QueryDispatchAction extends DispatchAction { public ActionForward query(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { javax.sql.DataSource dataSource = null; java.sql.Connection myConnection = null; try { dataSource = getDataSource(request); if (null == dataSource) { System.out.println("NULL"); } else { System.out.println("NOT NULL"); } 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); } } Scott K Purcell | Developer | VERTIS | 555 Washington Ave. 4th Floor | St. Louis, MO 63101 | 314.588.0720 Ext:1320 | [EMAIL PROTECTED] | http://www.vertisinc.com Vertis is the premier provider of targeted advertising, media, and marketing services that drive consumers to marketers more effectively. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]