pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fork <mfork00@yahoo.com>
To: Kris Jurka <books@ejurka.com>
To: Maciek Sakrejda <msakrejda@truviso.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PSQLException: The column name <col> was not found in this ResultSet.
Date: Wed, 17 Nov 2010 21:26:20 -0800 (PST)
Message-ID: <604272.29775.qm@web113402.mail.gq1.yahoo.com> (raw)
In-Reply-To: <alpine.BSO.2.00.1011141731440.13551@leary.csoft.net>
References: <270369.52816.qm@web113412.mail.gq1.yahoo.com>
	<alpine.BSO.2.00.1011091909160.7107@leary.csoft.net>
	<AANLkTimb4b+hv-8M+VwEUw_91y6Bw75u+i26sVZCD=kF@mail.gmail.com>
	<ibi7js$71l$1@news.albasani.net>
	<AANLkTimKWEdBdJS2gRFLYrHcAHNiA-Hx8=KGA7ucu3HH@mail.gmail.com>
	<ibij1o$kgv$1@news.albasani.net>
	<AANLkTimgd-ksOoersMpF=YhpZyWorY0n=cYxq3dDF4Fu@mail.gmail.com>
	<ibjg5n$2cm$1@news.albasani.net>
	<82k4kimq99.fsf@mid.bfk.de>
	<ibkl0d$i8l$1@news.albasani.net>
	<AANLkTi=J7=1TN5gxrKk5rVHy54X9UwwDCKjr-Y-1dSf5@mail.gmail.com>
	<alpine.BSO.2.00.1011141731440.13551@leary.csoft.net>

I am using the Spring Batch project 
(http://static.springsource.org/spring-batch/) to complete a large, parallel job 
configured to run 10 threads. 
 A org.springframework.batch.item.database.JdbcCursorItemReader<T> object is 
used to open the recordset using TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.  I 
tried following the code but was unable to figure out exactly how the recordset 
object was accessed and where.  

It does sound like the root of the problem lies in Spring Batch not properly 
synchronizing access to a recordset object and they should address the issue 
there if possible.  While I would like to see the issue in PostgreSQL JDBC 
driver addressed as it was the only problem I have encountered to date, I 
understand if it is not since there is no explicit thread safe guarantee around 
a recordset.
 Thanks.


Michael



----- Original Message ----
From: Kris Jurka <books@ejurka.com>
To: Maciek Sakrejda <msakrejda@truviso.com>
Cc: Michael Fork <mfork00@yahoo.com>; pgsql-jdbc@postgresql.org
Sent: Sun, November 14, 2010 5:44:33 PM
Subject: Re: [JDBC] PSQLException: The column name <col> was not found in this 
ResultSet.



On Sun, 14 Nov 2010, Maciek Sakrejda wrote:

> But we're getting really off-topic. Samuel suggested that the
> ResultSet interface does not guarantee thread safety (i.e., it does
> not promise that any implementation will be synchronized). As Till
> pointed out, the PostgreSQL implementation JDBC API *does* in fact
> promise thread safety (which is fine--an implementation can offer
> additional guarantees here, as per Hashtable and Map). This would
> suggest that we do need the fix that Michael originally suggested.
> 
> However--and I think this is the only real open issue--Florian pointed
> out that the guarantees in the PostgreSQL JDBC docs could be
> interpreted to mean that the PostgreSQL Connection is guaranteed to be
> thread-safe while ResultSet is not (especially given the dicey
> wasNull() issue).
> 

The real question is how realistic/useful is the coding pattern in question.  
There are other known thread safety problems in the driver that have not been 
dealt with.  For example two threads sharing a PreparedStatement, one executing 
it while the other is simultaneously calling setXXX on it.  The driver could 
synchonize this, but you'd random behavior behavior depending on which call 
happened first.  So no driver changes were made to help support this because it 
doesn't seem like a reasonable coding pattern.

Perhaps Michael could provide some additional context regarding the application 
and why multiple threads are processing the same ResultSet. You can avoid 
wasNull problems by only using getObject, but you'd still need to synchonize the 
next() calls.  And how much gain can you really get by parallel ResultSet 
reading?

Kris Jurka

-- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc




view thread (20+ messages)

Message-ID: <604272.29775.qm@web113402.mail.gq1.yahoo.com>
Permalink:  ../604272.29775.qm@web113402.mail.gq1.yahoo.com/
Also on:    postgresql.org/message-id/604272.29775.qm@web113402.mail.gq1.yahoo.com

 · 

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: mfork00@yahoo.com, books@ejurka.com, msakrejda@truviso.com
  Subject: Re: PSQLException: The column name <col> was not found in this ResultSet.
  In-Reply-To: <604272.29775.qm@web113402.mail.gq1.yahoo.com>
  References: <270369.52816.qm@web113412.mail.gq1.yahoo.com> <alpine.BSO.2.00.1011091909160.7107@leary.csoft.net> <AANLkTimb4b+hv-8M+VwEUw_91y6Bw75u+i26sVZCD=kF@mail.gmail.com> <ibi7js$71l$1@news.albasani.net> <AANLkTimKWEdBdJS2gRFLYrHcAHNiA-Hx8=KGA7ucu3HH@mail.gmail.com> <ibij1o$kgv$1@news.albasani.net> <AANLkTimgd-ksOoersMpF=YhpZyWorY0n=cYxq3dDF4Fu@mail.gmail.com> <ibjg5n$2cm$1@news.albasani.net> <82k4kimq99.fsf@mid.bfk.de> <ibkl0d$i8l$1@news.albasani.net> <AANLkTi=J7=1TN5gxrKk5rVHy54X9UwwDCKjr-Y-1dSf5@mail.gmail.com> <alpine.BSO.2.00.1011141731440.13551@leary.csoft.net> <604272.29775.qm@web113402.mail.gq1.yahoo.com>

* 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