Subject | VARBINARY |
---|---|
Author | Maaartin-1 |
Post date | 2010-11-14T11:44:40Z |
AFAIK, there's still no column type VARBINARY and VARCHAR CHARACTER SET
OCTETS COLLATE OCTETS gets used instead. This nearly works. My problem
is that ResultSet.getObject returns String and
ResultSetMetaData.getColumnType returns Type.VARCHAR, and there are at
least two problems with this:
- Quite often, the creation of the String fails, since arbitrary binary
data can't be decoded to it (I'm using UTF-8).
- I see no way, how to find out the "real" type, i.e., VARBINARY. I'm
using a method of mine like
List<Object[]> readAll(String query, Object... args)
which works fine with Hsqldb or Mysql (as long as the whole result set
fits in memory) and I need the objects to be of the proper type (i.e.,
byte[] for binary data). I can use ResultSet.getBytes for this, but I
can't tell the binary data from String.
Any idea?
OCTETS COLLATE OCTETS gets used instead. This nearly works. My problem
is that ResultSet.getObject returns String and
ResultSetMetaData.getColumnType returns Type.VARCHAR, and there are at
least two problems with this:
- Quite often, the creation of the String fails, since arbitrary binary
data can't be decoded to it (I'm using UTF-8).
- I see no way, how to find out the "real" type, i.e., VARBINARY. I'm
using a method of mine like
List<Object[]> readAll(String query, Object... args)
which works fine with Hsqldb or Mysql (as long as the whole result set
fits in memory) and I need the objects to be of the proper type (i.e.,
byte[] for binary data). I can use ResultSet.getBytes for this, but I
can't tell the binary data from String.
Any idea?