Re: "create type" custom types not supported by JDBC

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: "create type" custom types not supported by JDBC
Дата
Msg-id Pine.BSO.4.64.0712010330160.12362@leary.csoft.net
обсуждение исходный текст
Ответ на "create type" custom types not supported by JDBC  (Roy Smith <roy.smith@primetext.com>)
Ответы Re: "create type" custom types not supported by JDBC  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc

On Sat, 1 Dec 2007, Roy Smith wrote:

> I'm getting errors when I'm trying to access my custom data types through
> JDBC.
>
> If I don't supply a custom map using Connection.setTypeMap() then I'm
> getting ...
>
> org.postgresql.util.PGobject cannot be cast to Money at ...
> Money m = (Money) resultSet.getObject(1);  // Money is my class to handle
> multi-currency money types

It's not clear whether your type extends PGobject or implements SQLData.
Currently the PG driver only supports custom types via its own
non-standard method.  You must extend PGobject and register it with the
driver's non-standard type map via either PGConnection.addDataType()
or via a URL paramater.

> Poking around the source code of AbstractJdbc2Connection it looks like
> this functionality isn't support. Perhaps an "Unsupported feature" error
> would be more helpful than a ClassCastException.
>

Yes, it would.  I'll take a look.

Kris Jurka

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: AbstractJdbc2Array - another patch
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: "create type" custom types not supported by JDBC