From: Rajeev Menon <rajeev.menon.b@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Connection String
Date: Wed, 8 Mar 2006 13:54:27 +0530
Message-ID: <fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com> (raw)
This is how i have coded the connection handler
******
/*
// One Point Connection to the database.
//
*/
package beans;
import java.io.*;
import java.sql.*;
public final class ConnectionHandler
{
static String url;
static Connection con;
static boolean isConnected;
public static Connection getConnection ()
{
url="jdbc:postgresql://<ipaddress>:5432/<databasebname>";
try
{
Class.forName("org.postgresql.Driver");
}
catch (ClassNotFoundException e)
{
System.out.println("Printing The Exception :");
System.out.println (e);
System.out.println("Printing The Stack Trace :");
e.printStackTrace ();
}
try
{
System.out.println("****************B4
GETCONNECTION*********************************");
con = DriverManager.getConnection (url,"root","");
isConnected = true;
System.out.println("****************AFTER
GETCONNECTION*********************************");
catch (SQLException e)
{
System.out.println (e);
e.printStackTrace ();
}
return con;
}
*****
I'am using Tomcat.
The problem is that sometime the processing tends to slow down drastically
at this line "con = DriverManager.getConnection (url,"root","");" I know
this because when I see the catalina.out I can see the line
"****************B4 GETCONNECTION*********************************" and most
of the time the After Connection also come but occassionaly it just shows a
B4 connection line and waits and in the meantime as more and more users
login more and more B4 connections come up and suddenly the connecion is re
established. Could somone help because this is slowin down the system
--
RegardsRajeev Menon
EXCELLENCE IS MORE FUN THAN MEDIOCRITY!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: rajeev.menon.b@gmail.com
Subject: Re: Connection String
In-Reply-To: <fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com>
References: <fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox