File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes data-sources  with struts and oracle 10g 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 struts and oracle 10g" Watch "data-sources  with struts and oracle 10g" New topic

data-sources with struts and oracle 10g

misa misako

Joined: May 23, 2005
Posts: 2
Hi, Please help can you tell me how to use <data-sources> to load
oracle driver.

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(
at org.apache.commons.dbcp.BasicDataSource.setLogWriter(
at org.apache.struts.action.ActionServlet.initModuleDataSources(
at org.apache.struts.action.ActionServlet.init(
at javax.servlet.GenericServlet.init(
at com.evermind.server.http.HttpApplication.loadServlet(
at com.evermind.server.http.HttpApplication.findServlet(
at com.evermind.server.http.HttpApplication.getRequestDispatcher(
at com.evermind.server.http.HttpRequestHandler.processRequest(
at com.evermind.util.ReleasableResourcePooledExecutor$
I agree. Here's the link:
subject: data-sources with struts and oracle 10g
jQuery in Action, 3rd edition