Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6C9E863327C for ; Tue, 7 Apr 2009 08:13:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00856-06 for ; Tue, 7 Apr 2009 08:13:07 -0300 (ADT) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id 6CD64632E2F for ; Tue, 7 Apr 2009 08:13:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by mx1.hub.org (Postfix) with ESMTP id 79F44125A820 for ; Tue, 7 Apr 2009 08:13:13 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTPA id 22B743811399 for ; Tue, 7 Apr 2009 14:12:17 +0300 (EEST) From: "Peter" To: 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> In-Reply-To: <491f66a50904070324g19aee516vb5b1922b23450a27@mail.gmail.com> Subject: Re: What do people use for connection pooling with PostgreSQL JDBC Date: Tue, 7 Apr 2009 14:12:16 +0300 Message-ID: <00ac01c9b771$b627f830$2277e890$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00AD_01C9B78A.DB753030" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acm3axDreitavt5jT129OKYKH2aT/QABT+fw Content-Language: en-us X-MailScanner-ID: 22B743811399.56113 X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-6.799, required 6, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -5.00, HTML_MESSAGE 0.00) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com MailScanner-NULL-Check: 1239707537.99925@SlK8Az5JQS8jnUcjoPIc5w X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL=-0.000, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200904/7 X-Sequence-Number: 19454 This is a multipart message in MIME format. ------=_NextPart_000_00AD_01C9B78A.DB753030 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I think you can extract the underlying PGConnection object by calling = conn.getInnerMostDelegate() (sp?) method and then do your array stuff. = Your dbcp datasource has to allow access to underlying JDBC objects = however (there was a property to allow this). =20 From: pgsql-jdbc-owner@postgresql.org = [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Dave Cramer Sent: Tuesday, April 07, 2009 1:24 PM To: Hannu Krosing Cc: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] What do people use for connection pooling with = PostgreSQL JDBC =20 =20 On Tue, Apr 7, 2009 at 4:35 AM, Hannu Krosing = 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 =3D 0; FOR idx IN array_lower(valuelist, 1)..array_upper(valuelist, 1) LOOP result =3D 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 =3D { 1L, 2L }; PreparedStatement ps =3D 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 =20 -- Hannu Krosing http://www.2ndQuadrant.com PostgreSQL Scalability and Availability Services, Consulting and Training =20 ------=_NextPart_000_00AD_01C9B78A.DB753030 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

I think you can extract the underlying PGConnection = object by calling conn.getInnerMostDelegate() (sp?) method and then do your array stuff. = Your dbcp datasource has to allow access to underlying JDBC objects however (there = was a property to allow this).

 

From:= pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] = On Behalf Of Dave Cramer
Sent: Tuesday, April 07, 2009 1:24 PM
To: Hannu Krosing
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] What do people use for connection pooling = with PostgreSQL JDBC

 

 

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 =3D 0;
   FOR idx IN array_lower(valuelist, = 1)..array_upper(valuelist, 1) LOOP
       result =3D 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 =3D { 1L, 2L };
  PreparedStatement ps =3D 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

 

------=_NextPart_000_00AD_01C9B78A.DB753030--