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
![](https://coderanch.com/images/smilies/71f8fd38ff05e97f15e0e2462f286a02.gif)
racle:thin:@mac-0314:1521
![](https://coderanch.com/images/smilies/71f8fd38ff05e97f15e0e2462f286a02.gif)
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 ...