I configured BasicDataSource in struts-config.xml file. when i'm accesing getDataSource(request) for DataSource object, it's giving error. I already added all jar files in lib folder. What is the problem? Please clear my doubt.
Thanks in advance.
Chan Apex
Greenhorn
Joined: Oct 26, 2010
Posts: 16
posted
0
I loaded classes12.jar, tomcat-dbcp.jar, and all struts .jar files.
javax.sql.DataSource dataSource;
java.sql.Connection myConnection=null;
try {
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
Statement stmt=myConnection.createStatement();
}
catch(Exception e) {
//
}
giving the compile time error at getDataSource(request) method.
What is the problem??
This method is being invoked on the local class. Does your local class have an implementation of this method?
If you are counting on the Struts datasource functionality, it was deprecated long ago. See here for the preferred method for accessing a database.