I'm not a JDBC expert, but this is pretty much the way I'd expect it to
work. If you a have fixed length field, then the field should return that
many characters. The varchar implies it's variable length, so trailing
spaces would then not be included.
David
---(end of
In my code where I need to store short pieces of binary data (like
digests) I encode them in hex and store the hex. Yes this results in a
2 times increase in storage, and some overhead in encoding/decodeing,
but it isn't too bad. Sure you could use other encodings for the binary
data, but
ByteArrayInputStream bis = new ByteArrayInputStream(data);
ObjectInputStream p = new ObjectInputStream(bis);
EncryptionInfo ei = (EncryptionInfo)p.readObject();
Are you using setBytes/getBytes in JDBC? That's worked for me when the SQL
type is OID on 7.1beta4.
David
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