Connection String

From: "Rajeev Menon" <rajeev(dot)menon(dot)b(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Connection String
Date: 2006-03-08 08:24:27
Message-ID: fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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!

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Dudziak 2006-03-08 13:37:50 Performance problem with timestamps in result sets
Previous Message David Fetter 2006-03-07 16:35:11 Re: DATE SQL