This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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>
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: upgraded tomcat from 5.0 to 5.5 and could not connect to DB
 
jQuery in Action, 3rd edition