pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Michael Bell <mikebell90@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC broken connection against Postgres 8.4
Date: Tue, 18 Aug 2009 21:14:55 -0600
Message-ID: <4A8B6E2F.6020507@ttc-cmc.net> (raw)
In-Reply-To: <373045.63755.qm@web43145.mail.sp1.yahoo.com>
References: <400613.99933.qm@web43143.mail.sp1.yahoo.com>
	<4A897BD9.8010303@ttc-cmc.net>
	<169596.59170.qm@web43141.mail.sp1.yahoo.com>
	<c3c74eec0908180456o3496ab4eu58fa8afbec9c368@mail.gmail.com>
	<373045.63755.qm@web43145.mail.sp1.yahoo.com>

> As you see below, something seems....whacked. A simple loop with an 
> unpooled connection (code provided below) often gives an exception 
> when connecting. The Thread.sleep statement has been made as high as 
> 5000 ms, and exceptions still sporadically occur.
>
> I don't know if this is a JDBC driver issue or core server issue. Or 
> something here. But the code is so simple....
>
> Single box test (client, server on same machine, accessing 127.0.0.1)
> Postgesql 8.4.01
> JDBC3 8.4.701 (also tried 8.3.603)
> Sun JDK 1.5_16
> Windows XP SP3, 2GB RAM, 64MB-1GB heap
>
> Exception in thread "main" org.postgresql.util.PSQLException: The 
> connection attempt failed.
>     at 
> org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:137)
>     at 
> org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
>     at 
> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124)
>     at 
> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
>     at 
> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>     at org.postgresql.Driver.makeConnection(Driver.java:386)
>     at org.postgresql.Driver.connect(Driver.java:260)
>     at java.sql.DriverManager.getConnection(Unknown Source)
>     at java.sql.DriverManager.getConnection(Unknown Source)
>     at com.gwava.db.DerbyConnectionPool.main(DerbyConnectionPool.java:193)
> Caused by: java.net.SocketException: Connection reset
>     at java.net.SocketInputStream.read(Unknown Source)

>
> I'm unable to reproduce the exception on a common client with the two 
> PostgreSQL 8.3.x database configurations, one local the other on the 
> network, listed below.
>
> All linux configurations
>
> Client:
>
> java version "1.5.0_12"
> jdbc version: "postgresql-8.3-603"
>
> Database Hosts:
>
> Host: 127.0.0.1
> -- Generated On: 2009.08.17 AD at 09:24:16 MDT
> -- SQL version: PostgreSQL 8.3.3
> -- Database: world
>
> -- Host: cindy.dandymadeproductions.net
> -- Generated On: 2009.08.17 AD at 09:10:41 MDT
> -- SQL version: PostgreSQL 8.3.0
> -- Database: world
>
> danap
>
> 2009/8/17 Michael Bell <mikebell90@yahoo.com>
>
> I am not surprised. I strongly suspect this is an issue with
> Windows/PostgresSQL. OTOH, I did most of my testing against Postgres 8.4
> server.


I'm still unable to reproduce the exception on the given configuration 
when the JDBC has
been upgraded to postgresql-8.4-701.jdbc3. I will upgrade to PostgreSQL 
8.4 tomorrow,
been meaning to, on one of the systems and try again. I realize you are 
talking about 8.4
and what I was trying to do is provide an elimination of one or more 
variables to isolate
the problem, so the experts here could focus, which I believe they may 
have already done. I
also understand that mine are Linux and your is windows and you believe 
there lies the possible
whack so to speak. Couple of things though:

1. The original test code you provided I believe is not doing exactly 
what you think. con is never
     NULL besides the first time through the loop, which the test to 
close the connection is taking
    place no matter whether a connection was established or not. You 
always close the connection,
    Suggest you try:

    } finally {
            if (con != null)
            {
                con.close();
                con = null;
            }

    I know this is probably be nothing, but your code is just not doing 
what you set it up to do.
   

2. If you say your connection is not pooled, why in your original 
exception trace, quoted above, is:

-> at com.gwava.db.DerbyConnectionPool.main(DerbyConnectionPool.java:193)

danap



view thread (14+ messages)  latest in thread

Message-ID: <4A8B6E2F.6020507@ttc-cmc.net>
Permalink:  ../4A8B6E2F.6020507@ttc-cmc.net/
Also on:    postgresql.org/message-id/4A8B6E2F.6020507@ttc-cmc.net

 · 

reply

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: danap@ttc-cmc.net, mikebell90@yahoo.com
  Subject: Re: JDBC broken connection against Postgres 8.4
  In-Reply-To: <4A8B6E2F.6020507@ttc-cmc.net>
  References: <400613.99933.qm@web43143.mail.sp1.yahoo.com> <4A897BD9.8010303@ttc-cmc.net> <169596.59170.qm@web43141.mail.sp1.yahoo.com> <c3c74eec0908180456o3496ab4eu58fa8afbec9c368@mail.gmail.com> <373045.63755.qm@web43145.mail.sp1.yahoo.com> <4A8B6E2F.6020507@ttc-cmc.net>

* 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