Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat Database Connection Pooling Error

 
Sankar Srinivasan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a database connection pool using the Oracle 9i database, but I am getting following error

I am using tomcat version 5.0.19

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver

I have copied the classes12.jar to /common/lib folder of tomcat installation.

Following are my entries config files as follows

in server.xml
<GlobalNamingResources>

<Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myoracle">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc racle:thin:@10.60.4.25:1521:mydb</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</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>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

Following are entries in my application context xml named as jsp-examples.xml

<context path="/jsp-examples" docBase="/jsp-examples" debug="1">
<ResourceLink global="jdbc/myoracle" name="jdbc/myoracle" type="javax.sql.DataSource" />
</context>

I have also included following lines in my WEB-INF/web.xml file

<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Could some please help me in solving this problem, I struggling with this issue for more than a week.

Thanks
Sankar Srinivasan
[ March 17, 2006: Message edited by: Sankar Srinivasan ]
 
Udayakumar Reddy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is a simple way of dong the connection pooling in the Tomcat.

Goto http://localhost:8080/admin

Give username and password default are admin&admin

Then Goto TomcatServer->Service->Host->Ur webapplication->DataSources

Then in the right pan select the Create new DataSource from the combo box.
Give the necessary details in the form and click on save button.
And then logout the admin.

The configuration file will be in the $CATALINA_HOME/conf/Cataline/localhost folder with the ur webapplication name.The extension is .xml.

Then restart ur Tomcat server.
Then try to lookup for the JNDI name which is given in the form and u can get the DataSource from that.then enjoy.........

Reddy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic