Skip site navigation (1) Skip section navigation (2)

Re: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend

From: "Albe Laurenz *EXTERN*" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Albretch Mueller *EXTERN*" <lbrtchx(at)gmail(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend
Date: 2008-05-07 11:25:41
Message-ID: D960CB61B694CF459DCFB4B0128514C2021221AA@exadv11.host.magwien.gv.at (view raw or flat)
Thread:
Lists: pgsql-jdbc
Albretch Mueller wrote:
> adduser [...]

Why you create an operating system user is beyond me, but that
doesn't matter.

You start the database server as user "postgres", and you don't have
to be a specific OS user to use the client.
Maybe you are confusing database users and OS users.

However, that's not important for the problem at hand.

>  But then when I try my java code I get exactly the same error and
> this is what gets logged
> ~
> LOG:  database system was shut down at 2008-05-06 23:51:37 EDT
> LOG:  autovacuum launcher started
> LOG:  database system is ready to accept connections
> LOG:  connection received: host=[local]
> LOG:  connection authorized: user=pgtest database=testdb
> LOG:  statement: select current_timestamp;
> LOG:  statement: select * from testtbl;
> LOG:  connection received: host=127.0.0.1 port=35036
> LOG:  connection authorized: user=pgtest database=testdb
> LOG:  execute <unnamed>: SELECT
> n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,def.adsrc,dsc.description,t.typbasetype, t.typtype
>  FROM pg_catalog.pg_namespace n  JOIN pg_catalog.pg_class c ON
> (c.relnamespace = n.oid)  JOIN pg_catalog.pg_attribute a ON
> (a.attrelid=c.oid)  JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid)
> LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND
> a.attnum = def.adnum)  LEFT JOIN pg_catalog.pg_description dsc ON
> (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)  LEFT JOIN
> pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND
> dc.relname='pg_class')  LEFT JOIN pg_catalog.pg_namespace dn ON
> (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog')  WHERE a.attnum >
> 0 AND NOT a.attisdropped  AND c.relname LIKE 'testtbl'  ORDER BY
> nspname,relname,attnum
> LOG:  disconnection: session time: 0:00:00.289 user=pgtest
> database=testdb host=127.0.0.1 port=35036

I think the case is clear.

You close the database connection before you issue your statement!

Two things speak in favor of that:
- There is a disconnection message in your log.
- I can reproduce the error message by close()ing the connection before
  execute()ing a statement.

That one statement that gets logged retrieves details about the table
definition of "testtbl".
Is it your JDBC code that issues that statement? If not, what is it?
Is there additional software involved?

Examine the code for a Connection.close() that takes place before the
Statement.execute().

Yours,
Laurenz Albe

In response to

pgsql-jdbc by date

Next:From: Peter EisentrautDate: 2008-05-07 12:25:09
Subject: German translation fixes
Previous:From: Albretch MuellerDate: 2008-05-07 09:54:35
Subject: Re: org.postgresql.util.PSQLException: An I/O error occured while sending to the backend

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group