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]
# 1
RTFM
SoulTech2012a at 2007-7-13 2:16:40 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
> RTFMnice attitude
jrlaughlina at 2007-7-13 2:16:40 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Bad attitude
sduraia at 2007-7-13 2:16:40 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

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.)

%

duffymoa at 2007-7-13 2:16:40 > top of Java-index,Other Topics,Patterns & OO Design...
# 5
I beleive datasource definitions in struts config has been deprecated, are you sure you want your struts actions doing database stuff?While you may wan't db connection and session to be open before your action is called, it may not be a good idea if they know it.
jhhdka at 2007-7-13 2:16:41 > top of Java-index,Other Topics,Patterns & OO Design...
# 6
What version struts are you using ?
ManjunathaReddya at 2007-7-13 2:16:41 > top of Java-index,Other Topics,Patterns & OO Design...
# 7
i am using Strits 1.1 useing
kviji_1895@yahoo.co.ina at 2007-7-13 2:16:41 > top of Java-index,Other Topics,Patterns & OO Design...
# 8
> i am using Strits 1.1 useingLet's see - this post is almost a year old and you weren't part of the original discussion. So why are you answering as if the question regarding Struts version is addressed to you? Do you have a question?%
duffymoa at 2007-7-13 2:16:41 > top of Java-index,Other Topics,Patterns & OO Design...
# 9

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())

{

.......

struts_oraclea at 2007-7-13 2:16:41 > top of Java-index,Other Topics,Patterns & OO Design...