wood burning stoves 2.0*
The moose likes Struts and the fly likes data-sources with oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "data-sources with oracle" Watch "data-sources with oracle" New topic

data-sources with oracle

misa misako

Joined: May 23, 2005
Posts: 2
Hi, Please help I am learning to struts frame work.
Can any body tell me why I am getting this error.
Like where i have to define the database connection and which class i have to mention for data base related things.If possible pls send me the step wise code .

I am using oracle10g

here is my struts-config
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
<set-property property="driverClassName"
<set-property property="url" value="jdbc racle:thin:@xyz:1521:abc"/>
<set-property property="username" value="123"/>
<set-property property="password" value="123"/>
<set-property property="valida" value="SELECT SYSDATE FROM DUAL"/>

inside my code

Double price = null;
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
DataSource dataSource = null;
try {
dataSource = getDataSource(request);
System.out.println("dataSource :"+ dataSource);
conn = dataSource.getConnection();
System.out.println("myConnection:"+ conn);

I got this error on servlet

503 Service Unavailable
Servlet error: Initializing application data source org.apache.struts.action.DATA_SOURCE

and in java side i got this error

SEVERE: Initializing application data source org.apache.struts.action.DATA_SOURCE
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:545)
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:381)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1087)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:259)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2094)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4523)
at com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2561)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:640)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

I am going to move this to the more appropriate Struts forum.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
subject: data-sources with oracle
Similar Threads
OC4J struts issue
Struts DB Error
data-sources with struts and oracle 10g
Connection pooling
Digester.getParser: error