Обсуждение: Accessing BIT(n) type from Java

Поиск
Список
Период
Сортировка

Accessing BIT(n) type from Java

От
Petr Andrs
Дата:
Hi all,

I need to use BIT(n) type for storing large bitmaps into database and
access them from Java. But when I am retrieving data into Java via JDBC
only null (ie no data) is returned and I receive error mesage saying
something like that I have no conversion or mapping for BIT type
although Java's java.util.BitSet perfectly matches PostgreSQL's BIT(n)
type. Is it possible to get data with BIT(n) type into Java. And if yes,
how?

Thanks.

pa


Re: Accessing BIT(n) type from Java

От
Barry Lind
Дата:
Petr,

There currently isn't support for the bit(n) datatype.  This is
primarily due to the fact the the jdbc spec (at least from my reading)
doesn't have support for this type.  The jdbc spec does have t BIT type
but that is really the same as the postgres boolean datatype.

I would suggest that you use the bytea type instead.

--Barry


Petr Andrs wrote:
> Hi all,
>
> I need to use BIT(n) type for storing large bitmaps into database and
> access them from Java. But when I am retrieving data into Java via JDBC
> only null (ie no data) is returned and I receive error mesage saying
> something like that I have no conversion or mapping for BIT type
> although Java's java.util.BitSet perfectly matches PostgreSQL's BIT(n)
> type. Is it possible to get data with BIT(n) type into Java. And if yes,
> how?
>
> Thanks.
>
> pa
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: Accessing BIT(n) type from Java

От
Petr Andrs
Дата:
This is really unpleasant situation since I intended to use binary
AND/OR operators with BIT(n) in SELECTs which as I know is not possible
with BYTEA type. So is there ANY way how use BIT(n) from Java even if it
will cause PostgereSQL specific and JDBC not compliant code (for example
using some PostgreSQL extensions or treating it as custom datatype or
whatever is possible) or should I definitely forget using BIT(n) from Java?

pa

On 26.12.2002 19:52, Barry Lind wrote:
> Petr,
>
> There currently isn't support for the bit(n) datatype.  This is
> primarily due to the fact the the jdbc spec (at least from my reading)
> doesn't have support for this type.  The jdbc spec does have t BIT type
> but that is really the same as the postgres boolean datatype.
>
> I would suggest that you use the bytea type instead.
>
> --Barry
>
>
> Petr Andrs wrote:
>
>> Hi all,
>>
>> I need to use BIT(n) type for storing large bitmaps into database and
>> access them from Java. But when I am retrieving data into Java via
>> JDBC only null (ie no data) is returned and I receive error mesage
>> saying something like that I have no conversion or mapping for BIT
>> type although Java's java.util.BitSet perfectly matches PostgreSQL's
>> BIT(n) type. Is it possible to get data with BIT(n) type into Java.
>> And if yes, how?
>>
>> Thanks.
>>
>> pa
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>
>
>
>


Re: Accessing BIT(n) type from Java

От
Barry Lind
Дата:
Petr,

You should be able to use getString()/setString() with any datatype.

thanks,
--Barry



Petr Andrs wrote:
> This is really unpleasant situation since I intended to use binary
> AND/OR operators with BIT(n) in SELECTs which as I know is not possible
> with BYTEA type. So is there ANY way how use BIT(n) from Java even if it
> will cause PostgereSQL specific and JDBC not compliant code (for example
> using some PostgreSQL extensions or treating it as custom datatype or
> whatever is possible) or should I definitely forget using BIT(n) from Java?
>
> pa
>
> On 26.12.2002 19:52, Barry Lind wrote:
>
>> Petr,
>>
>> There currently isn't support for the bit(n) datatype.  This is
>> primarily due to the fact the the jdbc spec (at least from my reading)
>> doesn't have support for this type.  The jdbc spec does have t BIT
>> type but that is really the same as the postgres boolean datatype.
>>
>> I would suggest that you use the bytea type instead.
>>
>> --Barry
>>
>>
>> Petr Andrs wrote:
>>
>>> Hi all,
>>>
>>> I need to use BIT(n) type for storing large bitmaps into database and
>>> access them from Java. But when I am retrieving data into Java via
>>> JDBC only null (ie no data) is returned and I receive error mesage
>>> saying something like that I have no conversion or mapping for BIT
>>> type although Java's java.util.BitSet perfectly matches PostgreSQL's
>>> BIT(n) type. Is it possible to get data with BIT(n) type into Java.
>>> And if yes, how?
>>>
>>> Thanks.
>>>
>>> pa
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 2: you can get off all lists at once with the unregister command
>>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>>
>>
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: Accessing BIT(n) type from Java

От
Dave Cramer
Дата:
There is a precedence for this in the postgis project. They extend the
jdbc types to include the PGGeometry type. Currently they are keeping
their own version of the driver in their project. What I would like to
see is a way to register types with the driver and then a subsequent
getObject would return the registered type

Dave
On Thu, 2002-12-26 at 14:32, Barry Lind wrote:
> Petr,
>
> You should be able to use getString()/setString() with any datatype.
>
> thanks,
> --Barry
>
>
>
> Petr Andrs wrote:
> > This is really unpleasant situation since I intended to use binary
> > AND/OR operators with BIT(n) in SELECTs which as I know is not possible
> > with BYTEA type. So is there ANY way how use BIT(n) from Java even if it
> > will cause PostgereSQL specific and JDBC not compliant code (for example
> > using some PostgreSQL extensions or treating it as custom datatype or
> > whatever is possible) or should I definitely forget using BIT(n) from Java?
> >
> > pa
> >
> > On 26.12.2002 19:52, Barry Lind wrote:
> >
> >> Petr,
> >>
> >> There currently isn't support for the bit(n) datatype.  This is
> >> primarily due to the fact the the jdbc spec (at least from my reading)
> >> doesn't have support for this type.  The jdbc spec does have t BIT
> >> type but that is really the same as the postgres boolean datatype.
> >>
> >> I would suggest that you use the bytea type instead.
> >>
> >> --Barry
> >>
> >>
> >> Petr Andrs wrote:
> >>
> >>> Hi all,
> >>>
> >>> I need to use BIT(n) type for storing large bitmaps into database and
> >>> access them from Java. But when I am retrieving data into Java via
> >>> JDBC only null (ie no data) is returned and I receive error mesage
> >>> saying something like that I have no conversion or mapping for BIT
> >>> type although Java's java.util.BitSet perfectly matches PostgreSQL's
> >>> BIT(n) type. Is it possible to get data with BIT(n) type into Java.
> >>> And if yes, how?
> >>>
> >>> Thanks.
> >>>
> >>> pa
> >>>
> >>>
> >>> ---------------------------(end of broadcast)---------------------------
> >>> TIP 2: you can get off all lists at once with the unregister command
> >>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >>>
> >>
> >>
> >>
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
--
Dave Cramer <Dave@micro-automation.net>