How to insert binary data - Mailing list pgsql-jdbc

From Markus Schaber
Subject How to insert binary data
Date
Msg-id 20040604151952.3ad9369a@kingfisher.intern.logi-track.com
Whole thread Raw
Responses Re: How to insert binary data
List pgsql-jdbc
Hi,

Today, I had some problems inserting Data via WKB format (which we
suspect to be more efficient compared to the text representation) into a
PostGIS database through JDBC.

We have the data as a byte array, but either
PreparedStatement.setBytes() and .setObject() failed to work.

After some experimentation, I found that I have to encode the byte array
into hex, and then it works (which is ugly because we need to
pre-process the data and double the data size).

For retreiving wkb data, there is a bytea() function that returns the
binary data, but there seems to be no constructor for wkb postgres type
that uses binary data.

It also looks like the PGObject subclassing mechanism only works for
String representations, and the JDBC TypeMap mechanism is not
implemented.

Is there any way that allows efficient storing of WKB data into PostGIS?

Thanks,
Markus
--
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com

pgsql-jdbc by date:

Previous
From: Christian van der Leeden
Date:
Subject: Transactions not idle but "idle in transaction" since 7.4 and JDBC 7.4.213
Next
From: "Chris Smith"
Date:
Subject: PATH: SSL flexibility and documentation