Connection String

Поиск
Список
Период
Сортировка
От Rajeev Menon
Тема Connection String
Дата
Msg-id fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com
обсуждение исходный текст
Список 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!

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: DATE SQL
Следующее
От: "Thomas Dudziak"
Дата:
Сообщение: Performance problem with timestamps in result sets