Michael,
What version of postgres and what version of the jdbc drivers are you using?
Also, more info would be helpful. When you say 'doesn't work' that
doesn't give us a lot to go on. Error messages and any output you are
getting would help a lot.
thanks,
--Barry
M. Dietrich wrote:
> hi everyone!
>
> i get still those fastpath errors with the jdbc drivers. i tested the
> driver installed with debian, the stable and the development driver
> from jdbc.postgresql.org. has anybody else the same problem?
>
> i use blobs alot. using blobs with pg-sql's jdbc does not work
> strait-forward in a jdbc-manner like this:
>
> statement.setBinaryStream(4, in, size);
>
> even this does not work:
>
> byte buffer[] = new byte[(int)size];
> in.read(buffer);
> statement.setBytes(4, buffer);
>
>
> so this one is what i found out works best for me:
>
> org.postgresql.largeobject.LargeObjectManager lom =
((org.postgresql.Connection)getConnection()).getLargeObjectAPI();
> int loid = lom.create();
> org.postgresql.largeobject.LargeObject blob = lom.open(loid);
> int s;
> byte buf[] = new byte[2048];
> while ((s = in.read(buf, 0, buf.length)) > 0)
> blob.write(buf, 0, s);
> blob.close();
> java.sql.Blob b = new org.postgresql.largeobject.PGblob((org.postgresql.Connection)getConnection(), loid);
> statement.setBlob(4, b);
>
> but using this i get the fast-path error. using the other versions
> results in a errormessage containing all the binary data.
>
> best regards,
>
> michael
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>