Re: What do people use for connection pooling with PostgreSQL JDBC

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: What do people use for connection pooling with PostgreSQL JDBC
Дата
Msg-id 1239112973.7647.23.camel@huvostro
обсуждение исходный текст
Ответ на Re: What do people use for connection pooling with PostgreSQL JDBC  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
On Tue, 2009-04-07 at 09:39 -0400, Dave Cramer wrote:
>
>
> On Tue, Apr 7, 2009 at 9:23 AM, Hannu Krosing <hannu@2ndquadrant.com>
> wrote:
>
>         On Tue, 2009-04-07 at 06:24 -0400, Dave Cramer wrote:
>         >
>         >
>         > 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
>
>
>         It's both dbcp and c3po.
>
>         I understand that dbcp and c3po work on some other databases
>         jdbc
>         drivers, so maybe I could also do
>
>         4) fix jdbc code to provide required createArrayOf support
>
>         no ?
>
> Well, the newer drivers support createArray, so perhaps you need a
> newer driver ?

As I said, yhis works when I use JDBC directly, or proxool connection
proxy

> As well as showing us the exception.

for dbcp -

java.lang.AbstractMethodError:
org.apache.tomcat.dbcp.dbcp.PoolingDataSource
$PoolGuardConnectionWrapper.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;


for c3p0 -

java.lang.AbstractMethodError:
com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;

Servlet code to test direct, proxool, c3po and dbcp attached

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

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Re: BLOB help - yes I've read around!
Следующее
От: Brad Milne
Дата:
Сообщение: Re: BLOB help - yes I've read around!