File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Sturts dataBase connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sturts dataBase connection problem" Watch "Sturts dataBase connection problem" New topic
Author

Sturts dataBase connection problem

suhas Koley
Greenhorn

Joined: May 24, 2007
Posts: 11
In the sturts-config.xml my code is :

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName"
value="com.mysql.jdbc.Driver" />

<set-property property="url"
value="jdbc:mysql://192.168.0.150:3306/java_video_prj" />
<set-property property="username"
value="root" />
<set-property property="password"
value="" />


</data-source>


in the action servlet i want to get the datasource using the method
DataSource dss = getDataSource(request);

It is showing the error :
Cannot resolve the symbol
method getDataSource(request);

I have put the sturts-lagency.jar into the lib folder but the thing does not change

Please help


PROFILE:<br />Suhas koley <br />email:suhas.koley@gmail.com<br />College:NIT(REC)Durgapur
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 137
The request object is of type ServletRequest or HttpServletRequest.

I doubt that it is of type ServletRequest if you are overriding
execute(ActionMapping mapping, ActionForm form,ServletRequest request, ServletResponse response)

instead of
execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)


Paras Jain
SCJP 5.0
suhas Koley
Greenhorn

Joined: May 24, 2007
Posts: 11
Hi Paras ,

Here is my code

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

// If user pressed 'Cancel' button,
try
{

//Showing Error cannot resolve the symbol getDataSource(request)
DataSource dataSource = getDataSource(request);





}
catch(Exception e)
{

}
please check that
suhas
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

check you have the commons.jar included in your classpath.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
suhas Koley
Greenhorn

Joined: May 24, 2007
Posts: 11
I have added the following jar in the WEB_INF/lib of my application

commons-beanutil.jar
commons-beanutil1.6.jar
commons-beanutil1.7.0.jar
commons-chain-1.1.jar
commons-collection.jar
commons-dbcp.jar


The error exactly is:

Cannot resolve the symbol :method getDataSource(request)

Please help
suhas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sturts dataBase connection problem