Skip site navigation (1) Skip section navigation (2)

How to insert binary data

From: Markus Schaber <schabios(at)logi-track(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: How to insert binary data
Date: 2004-06-04 13:19:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

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

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

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(at)logi-track(dot)com |


pgsql-jdbc by date

Next:From: Oliver JowettDate: 2004-06-05 00:22:35
Subject: Re: bug report
Previous:From: Vasiliev IvanDate: 2004-06-04 11:33:11
Subject: bug report

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group