pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedInconsistent Loading of Bytea accross platform
2+ messages / 1 participants
[nested] [flat]
* Inconsistent Loading of Bytea accross platform
@ 2010-12-06 05:31 Marc-André Laverdière <marc-andre@atc.tcs.com>
2010-12-06 11:19 ` Re: Inconsistent Loading of Bytea accross platform Marc-André Laverdière <marc-andre@atc.tcs.com>
0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Laverdière @ 2010-12-06 05:31 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
Our team has recently upgraded from PostgreSQL 8.4 to 9.0. We ran all
our tests on one Linux box, and everything ran fine. However, we ran
into problems in our pre-production environment. Here are the details
Developer's box: Ubuntu 10.10 with Sun JDK 1.6.0_22-b04
Preprod box: Windows 2003 server SP2 Enterprise Edition with Sun JVM
1.6.0_22-b04
We are using Hibernate 3.6 with infinispan cache and the latest JDBC
driver (build 801).
Our table has 2 bytea columns. The columns are supposed to contain data
of size 256 bytes. On the Linux box, we get our 256 bytes correctly. On
the Windows box, we get 511 bytes however.
I detailed my problem here:
http://stackoverflow.com/questions/4335088/hibernate-not-loading-postgresql-bytea-consistently
After narrowing it down, it seems like the issue would be in the driver,
not Hibernate, as I have the same problem using JDBC. Here is some
sample code.
ssess = xyz.getFactory().openStatelessSession();
Connection rawConn = sess.connection();
PreparedStatement ps =
rawConn.prepareStatement("select encryptedkey,encryptediv from abc
where id=?");
ps.setString(1,"fff4f538-aea5-4703-b9d6-dcd7829766e4");
ResultSet rs = ps.executeQuery();
if (rs.next()){
byte[] key = rs.getBytes("encryptedkey");
byte[] iv = rs.getBytes("encryptediv");
logger.info("Key:{}\tIV:{}", key.length, iv.length);
}
rs.close();
ps.close();
conn.close();
Any ideas what could be wrong here?
--
Marc-André Laverdière
Software Security Scientist
Innovation Labs, Tata Consultancy Services
Hyderabad, India
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Inconsistent Loading of Bytea accross platform
2010-12-06 05:31 Inconsistent Loading of Bytea accross platform Marc-André Laverdière <marc-andre@atc.tcs.com>
@ 2010-12-06 11:19 ` Marc-André Laverdière <marc-andre@atc.tcs.com>
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Laverdière @ 2010-12-06 11:19 UTC (permalink / raw)
To: pgsql-jdbc
Hello all,
After investigation, it turns out that the old 8.4 driver was in the jre
lib folder, which interfered with everything. Sorry for the false alarm.
Marc-André Laverdière
Software Security Scientist
Innovation Labs, Tata Consultancy Services
Hyderabad, India
On Monday 06 December 2010 11:01 AM, Marc-André Laverdière wrote:
> Hello,
>
> Our team has recently upgraded from PostgreSQL 8.4 to 9.0. We ran all
> our tests on one Linux box, and everything ran fine. However, we ran
> into problems in our pre-production environment. Here are the details
>
> Developer's box: Ubuntu 10.10 with Sun JDK 1.6.0_22-b04
> Preprod box: Windows 2003 server SP2 Enterprise Edition with Sun JVM
> 1.6.0_22-b04
>
> We are using Hibernate 3.6 with infinispan cache and the latest JDBC
> driver (build 801).
>
> Our table has 2 bytea columns. The columns are supposed to contain data
> of size 256 bytes. On the Linux box, we get our 256 bytes correctly. On
> the Windows box, we get 511 bytes however.
>
> I detailed my problem here:
> http://stackoverflow.com/questions/4335088/hibernate-not-loading-postgresql-bytea-consistently
>
> After narrowing it down, it seems like the issue would be in the driver,
> not Hibernate, as I have the same problem using JDBC. Here is some
> sample code.
>
> ssess = xyz.getFactory().openStatelessSession();
> Connection rawConn = sess.connection();
> PreparedStatement ps =
> rawConn.prepareStatement("select encryptedkey,encryptediv from abc
> where id=?");
> ps.setString(1,"fff4f538-aea5-4703-b9d6-dcd7829766e4");
> ResultSet rs = ps.executeQuery();
> if (rs.next()){
> byte[] key = rs.getBytes("encryptedkey");
> byte[] iv = rs.getBytes("encryptediv");
> logger.info("Key:{}\tIV:{}", key.length, iv.length);
> }
> rs.close();
> ps.close();
> conn.close();
>
> Any ideas what could be wrong here?
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-12-06 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 05:31 Inconsistent Loading of Bytea accross platform Marc-André Laverdière <marc-andre@atc.tcs.com>
2010-12-06 11:19 ` Marc-André Laverdière <marc-andre@atc.tcs.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox