Subject | Re: [Firebird-Java] reading binary data (CHARACTER SET OCTETS) |
---|---|
Author | Roman Rokytskyy |
Post date | 2006-08-28T16:45:19Z |
> Hi,This is correct, since they are interpreted according to the connection
>
> I have problem with reading binary data defined as CHAR(n) CHARACTER SET
> OCTETS using JayBird (1.5.x, 2.x).
>
> The values are returned as String, so non-ascii characters are
> corrupted.
encoding (and if none is specified, it uses default encoding for JVM).
> I think that correct type of binary data should be byte[].Depends. The CHAR/VARCHAR columns according to the JDBC specification are
by default mapped to String. That means that ResultSet.getObject(int) will
return you an instance of java.lang.String class. However, nobody prevents
you from using ResultSet.getBytes(int) method and you will get the raw
data.
> I'm using JayBird through 3rd party Java application KettleVARBINARY is not VARCHAR CHARACTER SET OCTESTS. And unfortunately Firebird
> (kettle.javaforge.com) which supports JDBC connections. With MySQL JDBC
> driver I have no problem, VARBINARY(n) column type is readed as byte[].
does not support VARBINARY type...
> The second question is: is there any way to read data defined as CHAR(n)Use the ResultSet.getBytes(int) method and ensure that you do not specify
> CHARACTER SET NONE as binary data? I don't want JayBird or JVM to make
> any character conversions when reading/writting data.
connection charSet or encoding.
Roman