Then I would point you to
http://tomcat.apache.org/tomcat-4.1-doc/jndi-resources-howto.html
and
http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html
for some excellent information on setting up this stuff. I don't think
you have to spec a resource factory as the built-in one for datasources
is a slightly refactored (package rename only) version of DBCP. Also,
the JDBC driver needs to be stored in common/lib of the tomcat
installation. Lastly, unless you are directly using the commons-dbcp
package or the commons-pool package in your code, the
commons-dbcp-xx.xx.jar and commons-pool.jar are not necessary in WEB-INF.
--David
Natasha N Wright wrote:
I am using Tomcat version 4. with JDK 1.4 (quite old i know!)
David Smith wrote:
Before we can offer any relevant advice, please let us know which
version of tomcat you are working with. There are configuration
differences between 5.0.x and 5.5.x.
--David
Natasha N Wright wrote:
Hi,
I am trying to create a servlet which connects to a oracle
database. My servlet is called from an HTML form. When it is
called i recieve a
javax naming exception Cannot create resource instance error.
Please can someone advise me what I need to configure? I get no
tomcat errors on startup.
Thankyou
i am calling the db connection with the following java:
---------------------------------
Context initial = new InitialContext();
Context envContext = (Context)initial.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/maindb");
tcon = ds.getConnection();
server.xml (within <context>)
--------------------------
<Resource name="jdbc/maindb" auth="Container"
type="javax.sql.DataSource" />
<ResourceParams name="jdbc/maindb">
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:[EMAIL PROTECTED]:1512:maindb</value>
</parameter>
<parameter>
<name>user</name>
<value>nnw03u</value>
</parameter>
<parameter>
<name>password</name>
<value>******</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
web.xml
------------------
<resource-ref>
<res-ref-name>jdbc/maindb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Jar files in WEB-INF/lib
---------------------------
classes12.jar
jasper-compiler.jar
commons-collections-3.1.jar
jasper-runtime.jar
commons-dbcp-1.2.1.jar
jsp-api.jar
commons-dbcp-1.2.jar
mysql-connector-java-3.1.8-bin.jar
commons-el.jar
naming-factory-dbcp.jar
commons-pool-1.3.jar
naming-java.jar
jasper-compiler-jdt.jar
This message has been checked for viruses but the contents of an
attachment
may still contain software viruses, which could damage your computer
system:
you are advised to perform your own checks. Email communications
with the
University of Nottingham may be monitored as permitted by UK
legislation.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]