RE : Postgres 8.0 + JDBC

From: "Johann Robette" <jrobette(at)onyme(dot)com>
To: "'Oliver Jowett'" <oliver(at)opencloud(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: RE : Postgres 8.0 + JDBC
Date: 2004-10-06 07:20:37
Message-ID: 005a01c4ab74$fd193460$a5010a0a@Johann
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

OK Thanks a lot for your answer.
But as I'm a newbie in this field, could you give me an example of how
to do that.

I've already checked the array typename and it is "_text".

You said :
"It seems possible to fix the driver to handle this case by making
setArray() derive a proper array type name i.e. ("_" +
Array.getBaseType()), and using that rather than 'text' as the parameter

type."

How to do that?

Thanks

JR

-----Message d'origine-----
De : Oliver Jowett [mailto:oliver(at)opencloud(dot)com]
Envoyé : mardi 5 octobre 2004 22:11
À : Johann Robette
Cc : pgsql-jdbc(at)postgresql(dot)org
Objet : Re: [JDBC] Postgres 8.0 + JDBC

Johann Robette wrote:

> java.sql.SQLException: ERROR: cannot cast type text to

> text[]

setArray has never worked particularly well; you're seeing another
manifestation here.

The underlying problem here is that:

- setArray() is claiming that the type it is setting is a VARCHAR
- the parameter is being passed as a typed parameter via the V3
protocol, with type = 'text'
- apparently you can't cast directly from text -> text[] (although you
can interpret an untyped literal as text[], which is why it worked
before).

It seems possible to fix the driver to handle this case by making
setArray() derive a proper array type name i.e. ("_" +
Array.getBaseType()), and using that rather than 'text' as the parameter

type.

I'll try to do this soon, but I'm a bit busy so it may be a few days.

A longer term fix is to properly implement array support in setArray()..

I've submitted patches in the past to do this but they've never made it
into the official driver.

-O

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glen Eustace 2004-10-06 07:26:50 Re: Mirroring databases in v8
Previous Message Shridhar Daithankar 2004-10-06 07:03:50 Re: Mirroring databases in v8

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ahmed Mousaad 2004-10-06 09:29:52 Re: correct installation of postgis ??
Previous Message Euler Taveira de Oliveira 2004-10-06 03:59:20 errors.properties fixes and translation update