JDBC Array and PostgreSQL driver - Mailing list pgsql-jdbc

From Christopher BROWN
Subject JDBC Array and PostgreSQL driver
Date
Msg-id CAHL_zcO3f+3cuJMCcj7y9Pc28SMk8NbbvyVaL+e8f6kFVAeW2w@mail.gmail.com
Whole thread Raw
List pgsql-jdbc
Hi,

I'm just starting to use the ARRAY type (mainly to get all values of what would otherwise be subqueries against "child" tables, referring to the "current" table using foreign keys).  Seems (so far) straightforward enough, but I've not a lot of complete reference information out there.

For example, SELECTs seem to return Integer[] (when calling resultSet.getArray("array_column").getArray()).  The JDBC tutorial indicates I should call "free()" on the array, but I can't figure out if that's just a warning for batch update resource usage.  Is this necessary for result sets?

Furthermore, is the type mapping documented somewhere?  For example, should I use trial and error to figure out if for updates I should use int[] or Integer[]?

Also, are there any downsides (performance and resource usage) for the use-case I cited at the start?  Previously, I ran two requests (one to select "parent" records", and one to select "child" records, and then associated the foreign keys in application code).  I discovered that "getArray()" returns an Integer[] in the debugger, and noticed that the value seems to be held in a string (Jdbc4Array.fieldString).

Thanks for any advice,
Christopher

pgsql-jdbc by date:

Previous
From: "Al Presseller"
Date:
Subject: Re: [JDBC] "Cached plan must not change result type" error when switching search_path via explicit execution of SET SEARCH_PATH = ...
Next
From: joseph howard
Date:
Subject: [JDBC] Please consider adding a getOpenCursors() or some such from the jdbc connection