pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
8.4 vs 8.1 AbstractJdbc2Array - Array retrieval
2+ messages / 2 participants
[nested] [flat]

* 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval
@ 2010-05-17 17:41 Andre Burkovski <AndreyMail@gmx.net>
  2010-05-17 18:06 ` Re: 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Andre Burkovski @ 2010-05-17 17:41 UTC (permalink / raw)
  To: pgsql-jdbc

Hello there,

I have this unexpected Exception
"org.postgresql.util.PSQLException: An I/O error occured while sending 
to the backend."
when i try to recover contents of an java.sql.Array via getArray() method.

I don't have an SSCCE (http://sscce.org/) yet, but for the same piece of 
code i tried both drivers: 8.1.414 and 8.4.701
And for the 8.1.414 the code runs fine. For the 8.4.701 (jdbc3 and jdbc4 
variant) i got the error above.

I did a little digging and debugging and found the following:
The cause of the error can be found in line 165 of 
org.postgresql.jdbc2.AbstractJdbc2Array.java (8.4.701src)
The the line
"connection.getTypeInfo().getArrayDelimiter(oid);"
requires the connection to be open.
This is not the case for 8.1.414!

This creates trouble, as i am using an ORM where data is cached. The 
data is available, but 8.4 driver requires the connection to be open. In 
the case of 8.1 driver the ORM is able to manage the retrieve the data 
via getArray() method although the connection is closed.

Any suggestions or comments? Are you okay with this description or 
should i upload an SSCCE somewhere?

Greetings
Andre B.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval
  2010-05-17 17:41 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval Andre Burkovski <AndreyMail@gmx.net>
@ 2010-05-17 18:06 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2010-05-17 18:06 UTC (permalink / raw)
  To: Andre Burkovski <AndreyMail@gmx.net>; +Cc: pgsql-jdbc



On Mon, 17 May 2010, Andre Burkovski wrote:

> I have this unexpected Exception
> "org.postgresql.util.PSQLException: An I/O error occured while sending to the 
> backend."
> when i try to recover contents of an java.sql.Array via getArray() method.
>
> I don't have an SSCCE (http://sscce.org/) yet, but for the same piece of code 
> i tried both drivers: 8.1.414 and 8.4.701
> And for the 8.1.414 the code runs fine. For the 8.4.701 (jdbc3 and jdbc4 
> variant) i got the error above.
>
> I did a little digging and debugging and found the following:
> The cause of the error can be found in line 165 of 
> org.postgresql.jdbc2.AbstractJdbc2Array.java (8.4.701src)
> The the line
> "connection.getTypeInfo().getArrayDelimiter(oid);"
> requires the connection to be open.
> This is not the case for 8.1.414!
>
> This creates trouble, as i am using an ORM where data is cached. The data is 
> available, but 8.4 driver requires the connection to be open. In the case of 
> 8.1 driver the ORM is able to manage the retrieve the data via getArray() 
> method although the connection is closed.

The change that was made between 8.1 and 8.4 was that in 8.1 the JDBC 
driver assumed that the array delimiter would be a comma which is true for 
most types, but not all.  The 8.4 driver checks with the server to see 
what the actual delimiter is.

So this change is intentional and the fact that you could access parts of 
a ResultSet without a valid Connection is just luck.  After Connection 
close you really shouldn't be able to access anything.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-05-17 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-17 17:41 8.4 vs 8.1 AbstractJdbc2Array - Array retrieval Andre Burkovski <AndreyMail@gmx.net>
2010-05-17 18:06 ` Kris Jurka <books@ejurka.com>

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