Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DataSource Problem

 
Chan Apex
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chan Apex wrote:giving the compile time error at getDataSource(request) method.
Please post the error that you are getting
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chan Apex wrote:
dataSource = getDataSource(request);


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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic