Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 688621337B5B for ; Mon, 6 Dec 2010 07:19:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 32054-02 for ; Mon, 6 Dec 2010 11:19:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from atcmail.atc.tcs.com (atcmail.atc.tcs.co.in [203.200.212.145]) by mail.postgresql.org (Postfix) with ESMTP id E33A21337B56 for ; Mon, 6 Dec 2010 07:19:11 -0400 (AST) Received: from [172.25.149.79] (marc.atc.tcs.com [172.25.149.79]) by atcmail.atc.tcs.com (8.13.8/8.13.8) with ESMTP id oB6BJ1X5026475 for ; Mon, 6 Dec 2010 16:49:04 +0530 Message-ID: <4CFCC6A5.3060601@atc.tcs.com> Date: Mon, 06 Dec 2010 16:49:01 +0530 From: =?ISO-8859-1?Q?Marc-Andr=E9_Laverdi=E8re?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Inconsistent Loading of Bytea accross platform References: <4CFC754F.9060600@atc.tcs.com> In-Reply-To: <4CFC754F.9060600@atc.tcs.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201012/27 X-Sequence-Number: 21265 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? >