• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Struts DB Error

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i am new to struts, now i exploring struts with database access,i am getting error in my datasource,
my code snippet,

String user=null;
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;

ServletContext ctx=servlet.getServletContext();
DataSource ds=(DataSource)
ctx.getAttribute(Action.DATA_SOURCE_KEY);
try
{
conn=ds.getConnection();
stmt=conn.createStatement();
//some other codes here
}
here Action.DATA_SOURCE_KEY this is giving error to me,also i have pasted my struts-config.xml data source configuration

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName"
value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url"
value="jdbc racle:thin:@mac-0314:1521 RCL" />
<set-property property="username" value="scott" />
<set-property property="password" value="tiger" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="500" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
</data-source>
</data-sources>

please help me ...
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please check below link

http://www.roseindia.net/struts/strutsdatasourcemanagerontomcat5.shtml
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read quetion 7 of the JavaRanch Struts FAQ
 
I just had the craziest dream. This tiny ad was in it.
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic