pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Hannu Krosing <hannu@2ndquadrant.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: What do people use for connection pooling with PostgreSQL JDBC
Date: Tue, 7 Apr 2009 06:24:23 -0400
Message-ID: <491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.com> (raw)
In-Reply-To: <1239093322.7647.9.camel@huvostro>
References: <1236241901.12460.6.camel@huvostro>
	<491f66a50903050513r46ab0531h4892e973dec51f18@mail.gmail.com>
	<1239016398.8411.2.camel@huvostro>
	<491f66a50904060443o7e80fae8mfb6f403fb9a53467@mail.gmail.com>
	<1239093322.7647.9.camel@huvostro>

On Tue, Apr 7, 2009 at 4:35 AM, Hannu Krosing <hannu@2ndquadrant.com> wrote:

> On Mon, 2009-04-06 at 07:43 -0400, Dave Cramer wrote:
> > huh ? What makes you think it doesn't deal with arrays ?
>
> I have a sample function, whit takes an array argument
>
> CREATE OR REPLACE FUNCTION arraySum(
>        multiplier bigint,
>        valuelist bigint[],
>        OUT result int
> ) AS
> $$
> BEGIN
>    result = 0;
>    FOR idx IN array_lower(valuelist, 1)..array_upper(valuelist, 1) LOOP
>        result = result + multiplier * valuelist[idx];
>    END LOOP;
>    RETURN;
> END;
> $$ LANGUAGE plpgsql SECURITY DEFINER;
>
>
> When I call this function directly via JDBC or using proxool I get a
> result, when doing it via c3p0 or dbcp I get an exception -
>
>   Long[] array = { 1L, 2L };
>   PreparedStatement ps = conn.prepareStatement(
>        "SELECT * FROM arraySum(?, ?)");
>   ps.setLong(1, 3L);
>   ps.setArray(2, conn.createArrayOf("bigint", array));
>   ps.execute();
>

OK, createArrayOf is a relatively new method. So .... you have a few ways
around this.

1) don't use it, create your own arrays.
2) fix the dbcp code
3) complain to dbcp people


>
>
> --
> Hannu Krosing   http://www.2ndQuadrant.com
> PostgreSQL Scalability and Availability
>   Services, Consulting and Training
>
>

view thread (14+ messages)  latest in thread

Message-ID: <491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.com>
Permalink:  ../491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.com/
Also on:    postgresql.org/message-id/491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.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: pg@fastcrypt.com, hannu@2ndquadrant.com
  Subject: Re: What do people use for connection pooling with PostgreSQL JDBC
  In-Reply-To: <491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.com>
  References: <1236241901.12460.6.camel@huvostro> <491f66a50903050513r46ab0531h4892e973dec51f18@mail.gmail.com> <1239016398.8411.2.camel@huvostro> <491f66a50904060443o7e80fae8mfb6f403fb9a53467@mail.gmail.com> <1239093322.7647.9.camel@huvostro> <491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.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