File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datasource configuration in struts.xml

 
Mariya Antony christopher
Ranch Hand
Posts: 49
Hibernate Java Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In struts2 for database configuration in struts.xml not working ,Kindly suggest the comments
I have tried following database configuration steps
<data-sources>
<data-source key="pizza">
<set-property property="driverClass"
value="sun.jdbc.odbc.JdbcOdbcDriver" />
<set-property property="url"
value="Jdbc:Odbc:issuetracking" />
<set-property property="username" value="sa" />
<set-property property="password" value="sa" />
</data-source>
</data-sources>

public String execute() throws Exception
{
HttpServletRequest request;
DataSource ds = getDataSource(request, "pizza");
Connection con = ds.getConnection();
setMessage(getText(MESSAGE));
return SUCCESS;
}
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We do not configure DataSource in struts.xml and we can do data source configuration using spring, hibernate Tomcat DataSource Configuration
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Mohana infers, datasource was removed from Struts after version 1.2.7.
Struts 2 is a very different framework from Struts 1.x (it is actually based on another framework, XWork). The fact that you are attempting to use datasource in Struts 2 makes me think you haven't worked much with Struts 2. Here is a summary of the differences.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic