SQL CHAR type using setByte()

From: "David Wall" <d(dot)wall(at)computer(dot)org>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: SQL CHAR type using setByte()
Date: 2001-03-13 21:58:34
Message-ID: 006701c0ac08$bfdb25a0$5a2b7ad8@expertrade.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I have a Java byte field that I'm trying to store in the database. It has a value of (byte)'0' which is a binary 48.

When I use preparedStatement.setByte() with that value, to store in a Postgresql CHAR field, it only stores a '4'. It's as if the binary 48 were being converted to a String and then the first byte from the string was stored in the database. I'm using 7.1.1beta4.

Does this make any sense? Am I using the wrong SQL type or the wrong JDBC PreparedStatement set call?

Thanks,
David

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Wall 2001-03-13 22:15:18 Re: SQL CHAR type using setByte()
Previous Message David Wall 2001-03-13 17:26:34 Re: serialized objects and JDBC driver