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

Re: PSQLException: The column name <col> was not found in this ResultSet.

From: Kris Jurka <books(at)ejurka(dot)com>
To: Michael Fork <mfork00(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PSQLException: The column name <col> was not found in this ResultSet.
Date: 2010-11-10 00:10:18
Message-ID: alpine.BSO.2.00.1011091909160.7107@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Mon, 8 Nov 2010, Michael Fork wrote:

> Caused by: org.postgresql.util.PSQLException: The column name mdn was not found
> in this ResultSet.
>
> I receive the above error message when accessing the JDBC resultset from 
> multiple threads.  It does not occur consistently, but roughly every 20 
> or 30 runs and almost immediately upon invocation.  Looking at 
> org/postgresql/jdbc2/AbstractJdbc2ResultSet.java it appears there is a 
> race condition around building columnNameIndexMap
> 
> I cannot confirm this, but I would guess that on thread enters, has the 
> NULL map and creates the new HashMap.  The second thread enters, sees 
> the non-NULL columnNameIndexMap, and gets to the HashMap.get call prior 
> to the first thread fully populating the map.  If this is the problem, 
> would wrapping the IF block in a synchronized(this) block fix it? 
>

That looks like the correct diagnosis and fix to me.

Kris Jurka


In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2010-11-10 00:21:07
Subject: Re: JDBC4 and JDK 1.6
Previous:From: Nathan SullinsDate: 2010-11-09 23:26:14
Subject: JDBC4 and JDK 1.6

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