Re: Re: Not able to insert array of integers into column of type integer array - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: Re: Not able to insert array of integers into column of type integer array
Date
Msg-id 506A4464.6090602@ringerc.id.au
Whole thread Raw
In response to Re: Not able to insert array of integers into column of type integer array  (pprotim <pprotim80@yahoo.com>)
List pgsql-jdbc
pprotim: It looks like you tried to reply here, but just posted the
quoted original message.

I've been looking at the JDBC standard to see if PgJDBC can legally
accept arrays of primitive types and strings, not just java.sql.Array .
While this is something that the standard does not require it seems to
be something people expect the driver to do, and something other drivers do.

If you work with and have tested with other drivers it'd be helpful to
know how they behave for as many different drivers as you have access to.

--
Craig Ringer

On 10/02/2012 12:08 AM, pprotim wrote:
>
> ------------------------------------------------------------------------
> *From:* Stefan Reiser [via PostgreSQL] <[hidden email]>
> *To:* pprotim <[hidden email]>
> *Sent:* Wednesday, September 26, 2012 9:40 PM
> *Subject:* Re: Not able to insert array of integers into column of type
> integer array
>
> When setting or updating arrays in a ResultSet or PreparedStatement you
> can't use java array types (Integer[], ...) -- they need to be wrapped
> in a "java.sql.Array". This is done using the Connection-object.
>
> here's an example with Floats:
>
>      Connection con = // your connection
>      Double[] dbArr =  // ... some java array
>      Array sqlArray = con.createArrayOf("float8", dbArr);
>
> Now "sqlArray" can be used with setArray() (or even setObject() ).
> (not sure where, but there were some other examples in the JDK-docs or
> pg-JDBC-docs ...)


pgsql-jdbc by date:

Previous
From: the6campbells
Date:
Subject: Re: data set combination of integer and decimal/numeric returns wrong result type
Next
From: Craig Ringer
Date:
Subject: Re: data set combination of integer and decimal/numeric returns wrong result type