Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes upgraded tomcat from 5.0 to 5.5 and could not connect to DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "upgraded tomcat from 5.0 to 5.5 and could not connect to DB" Watch "upgraded tomcat from 5.0 to 5.5 and could not connect to DB" New topic
Author

upgraded tomcat from 5.0 to 5.5 and could not connect to DB

Elias Ta
Greenhorn

Joined: Sep 29, 2008
Posts: 15
I upgraded from tomcat 5.0 to 5.5 and I am getting SQL exception "ERROR IN INITIALIZAING DB CONNECTION IN PAGESERVLET " as in the following sample code
try
{
InitialContext initialcontext = new InitialContext();
try
{
message.debug("getting context");
Context context = (Context)(new InitialContext()).lookup("java:comp/env");
message.debug("getting connection");
conn = ((DataSource)context.lookup("mydb")).getConnection();
message.debug("got connection");
processRequest(httpservletrequest, httpservletresponse);
}
catch(SQLException sqlexception)
{
message.error("ERROR: Initializing DB Connections in PageServlet");
}
finally
{
try
{
if(!conn.isClosed())
conn.close();
}
catch(SQLException sqlexception1) { }
}


a sample of my tomcat server.xml looks like this
<DefaultContext>
<Resource name="mydb" auth="container" type="javax.sql.DataSource" />

<ResourceParams name="mydb">

<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>

<parameter>
<name>url</name>
<value>jdbcracle:thin:@10.3.4.5:1521:kwdev01</value>
</parameter>

<parameter>
<name>username</name>
<value>abc</value>
</parameter>

<parameter>
<name>password</name>
<value>abc</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>200</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>50</value>
</parameter>

<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>

<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>

<parameter>
<name>removeAbandonedTimeout</name>
<value>300</value>
</parameter>

</ResourceParams>

</DefaultContext>
<!-- END ADDED FOR BRIGHTSERV -->
####################################

</Host>

</Engine>

</Service>

</Server>
 
wood burning stoves
 
subject: upgraded tomcat from 5.0 to 5.5 and could not connect to DB
 
Similar Threads
JDBC driver for MS Access
Static Connection object in BaseDAO class - Bad?
Connection pooling using Tomcat
DataSource class
problem in getting sybase Datasource in Tomcat 4.1.12