Re: Totally weird behaviour in org.postgresql.Driver - Mailing list pgsql-jdbc

From Peter
Subject Re: Totally weird behaviour in org.postgresql.Driver
Date
Msg-id 49ba2711$0$1341$834e42db@reader.greatnowhere.com
Whole thread Raw
In response to Totally weird behaviour in org.postgresql.Driver  ("Peter" <peter@greatnowhere.com>)
List pgsql-jdbc
> Couple things.... do you really need to synchronize twice in every method
> ???
> Have you looked at dbcp or c3po instead of re-inventing the wheel ?
>
> Can you supply us with a test case which does exhibit the bug ?

I'm fairly sure this is JVM/Tomcat bug I'm dealing with here. The test case
below was configured to run on every request received by servlet, but only
started exhibiting the weird behaviour after few hours of heavy load:


import java.sql.*;
import java.util.logging.Logger;

import org.postgresql.ds.PGSimpleDataSource;

public class PGTester {

 public static void main() {

  org.postgresql.ds.PGSimpleDataSource _ds=new
org.postgresql.ds.PGSimpleDataSource();
  _ds.setDatabaseName("mydb");
  _ds.setServerName("myhost");
  _ds.setPortNumber(5432);

  for (int i=0; i<20; i++) {
   Connector con = new Connector(i+1,_ds);
   new Thread(con, "Conn" ).start();
  }
 }

 private static class Connector implements Runnable {
  @SuppressWarnings("unused")
  private int _num;
  private PGSimpleDataSource _ds;

  Connector(int n, PGSimpleDataSource ds) {
   _num = n;
   _ds = ds;
  }

  public void run() {
   for (int i=0; i<100; i++) {
    try {
     Connection conn = _ds.getConnection("user","pass");
     // System.out.println("Connector " + _num + " made connection #" +
(i+1));
     conn.close();
    } catch (Exception e) {
     Logger.getLogger(this.getClass().getName()).severe(e.getMessage());
    }
   }
  }
 }

}






pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef
Next
From: Roland Roberts
Date:
Subject: ResultSet.getTimestamp(Calendar) off by one-hour