Hello cats!

I'm trying to implement connection pool with Oracle8 database. After some codewriting I stuck with a problem which I don't know how to solve. Here are my configs and source code.

--= [ server.xml ] =--
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080"
minProcessors="5"
maxProcessors="75"
enableLookups="true"
acceptCount="10"
debug="0"
connectionTimeout="20000"
useURIValidationHack="false" />
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true" />
<Host name="localhost"
debug="0"
appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true" />
<Context path="/esljsp" docBase="esljsp" debug="5"
reloadable="true">
<!-- I suspect I've chosen wrong class in "type" value -->
<Resource name="jdbc/esljsp-oracle"
type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
auth="Container"
description="Oracle database resource for esljsp project" />
<ResourceParams name="jdbc/esljsp-oracle">
<parameter>
<name>dataSourceName</name>
<value>oracle.jdbc.pool.OracleDataSource</value>
</parameter>
<parameter>
<name>description</name>
<value>Oracle database resource for esljsp project</value>
</parameter>
<parameter>
<name>serverName</name>
<value>db.server.ru</value>
</parameter>
<parameter>
<name>portNumber</name>
<value>1521</value>
</parameter>
<parameter>
<name>networkProtocol</name>
<value>tcp</value>
</parameter>
<parameter>
<name>databaseName</name>
<value>sidvalue</value>
</parameter>
<parameter>
<name>user</name>
<value>username</value>
</parameter>
<parameter>
<name>password</name>
<value>password</value>
</parameter>
</ResourceParams>
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_esljsp_log." suffix=".txt"
timestamp="true" />
</Context>
</Host>
</Engine>
</Service>
</Server>
--= [ / server.xml ] =--

--= [ / web.xml ] =--
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd";
>
<web-app>
<!--
<taglib>
<taglib-uri>/esl-adm.tld</taglib-uri>
<taglib-location>/WEB-INF/esl-adm.tld</taglib-location>
</taglib>
-->
<servlet>
<servlet-name>DBAccessTest</servlet-name>
<servlet-class>ru.rbcsoft.esljsp.DBAccessTest</servlet-class>
</servlet>
<servlet-mapping>
<!-- this servler creates OracleConnectionPoolDataSource instance right -->
<servlet-name>DBAccessTest</servlet-name>
<url-pattern>/dbaccess/DBAccessTest</url-pattern>
</servlet-mapping>
<resource-ref>
<description>Oracle database resource for esljsp project</description>
<res-ref-name>jdbc/esljsp-oracle</res-ref-name>
<res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
</web-app>
--= [ / web.xml ] =--

--= [ index.jsp ] =--
<%@ page isThreadSafe="false" info="Database access test|Index page"
contentType="text/html; charset=utf-8" %>
<%@ page import="javax.naming.InitialContext, javax.naming.Context" %>
<%@ page import="oracle.jdbc.pool.OracleConnectionPoolDataSource" %>
<html>
<head>
<title>Database access test: index page</title>
</head>
<body>
<%
Context ctx=new InitialContext();
OracleConnectionPoolDataSource oracpds=

(OracleConnectionPoolDataSource)ctx.lookup("java:comp/env/jdbc/esljsp-oracle");
out.print(oracpds);
%>
</body>
</html>
--= [ index.jsp ] =--

And I get this error:

javax.servlet.ServletException: Cannot create resource instance

But DBAccessTest servlet, mentioned above, cat instantiate OracleConnectionPoolDataSource.

As I understand, there is at leave to way to implement dbcp -- Tomcat way (org.apache.commons.dbcp.BasicDataSourceFactory) and Oracle way, and I've chosen wrong one. But I still want it to be done with Oracle implementation.
If there are any solid reasons that Tomcat way is better (except of interportability), I would love to hear them all!


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to