From: | Daniel Selinger <d(dot)selinger(at)focusmr(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | createArrayOf("bytea", Array<byte[]>) problem |
Date: | 2014-02-14 11:14:18 |
Message-ID: | 52FDFA8A.8040707@focusmr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi all,
I have a problem with submitting arrays of bytea to the database via
native jdbc arrays.
i'm trying to do the following:
List<byte[]> hashes = new ArrayList<>();
//add some SHA256 in form of byte[]
srcPst = srcConnection.prepareStatement("select array_dims(?)");
srcPst.setArray(1, srcConnection.createArrayOf("bytea", hashes.toArray()));
srcRs = srcPst.executeQuery();
srcRs.next();
srcRs.getString(1);
--> "[1:5][1:32]"
if i do the same thing on the database:
select array_dims(array_agg(hashcolumn)) from hashtable; (hashcolumn is
of type bytea(32))
--> "[1:5]"
now im struggling how to use the bound data from jdbc on the database,
because when i use the "[1:5][1:32]" array on the database for something
like
select * from hashtable where hashcolumn = ANY(?), i get no results,
although i retrieved the hashes from a resultset on exaclty this table
with getBytes("hashcolumn")
any suggestions or hints on what i might doing wrong?
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2014-02-14 13:08:13 | Re: Time for a new release? |
Previous Message | Dave Cramer | 2014-02-14 11:12:40 | Re: Time for a new release? |