Struts database connectivity
I want to connect my oracle databse in my Struts application
Plz give me steps for connection
I have written following code instruts-config.xml
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="autoCommit" value="false"/>
<set-property property="description" value="Example Data Source Configuration"/>
<set-property property="driverClass" value="oracle.jdbc.OracleDriver"/>
<set-property property="maxCount" value="4"/>
<set-property property="minCount" value="2"/>
<set-property property="password" value="mypassword"/>
<set-property property="url" value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.128)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=elster)(SERVER=DEDICATED)))"/>
<set-property property="user" value="myusername"/>
</data-source>
</data-sources>
and in my action class i have added the following code
try
{
DataSource ds = getDataSource(request);
Connection conn = ds.getConnection();
But i am getting the following error
HTTP Status 404 - Servlet action is not available
--
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
--
Apache Tomcat/5.0.27
[1514 byte] By [
Atul4ua] at [2007-10-1 20:15:24]

this has nothing to do with the database.
it says you haven't deployed your web app correctly.
that oracle url is incorrect, too. when you figure out what you did wrong with your deployment you still won't be able to connect to the oracle database that way.
go look up the proper syntax for the oracle thin driver url. (hint: it has nothing to do with tnsnames.ora - you don't need the oracle client installed at all if you use the thin driver.)
%
Hi Atul and all,
Can any one guide me I am getting same error HTTP 404 Action not found when i am trying to connect to oracle DB in my local machine. I am using struts 1.2.9. Following is my struts config.xml
<data-sources>
<data-source
type="org.apache.common.dbcp.BasicDataSource">
<set-property property="driverClassName"
vlaue="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url"
vlaue="jdbc:oracle:thin:
@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))"/>
<set-property property="username"
vlaue="scott"/>
<set-property property="password"
vlaue="tiger"/>
</data-source>
</data-sources>
public class LookupAction extends Action
{
public Double getQuote(String symbol,
HttpServletRequest request)
throws Exception
{
Double price=null;
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
DataSource dataSource=null;
try
{
dataSource = getDataSource(request);
conn= dataSource.getConnection();
stmt= conn.createStatement();
rs= stmt.executeQuery("select * from stocks where" + "symbol='" + symbol +"'");
if (rs.next())
{
.......