Subject | Re: reading binary data (CHARACTER SET OCTETS) |
---|---|
Author | d_kozik |
Post date | 2006-08-29T08:01:13Z |
Thank Roman. I'll consult this with Kettle developers to enable
reading CHAR/VARCHAR as binary.
David
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@...> wrote:
reading CHAR/VARCHAR as binary.
David
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@...> wrote:
>CHARACTER SET
> > Hi,
> >
> > I have problem with reading binary data defined as CHAR(n)
> > OCTETS using JayBird (1.5.x, 2.x).specification are
> >
> > The values are returned as String, so non-ascii characters are
> > corrupted.
>
> This is correct, since they are interpreted according to the connection
> 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
> by default mapped to String. That means thatResultSet.getObject(int) will
> return you an instance of java.lang.String class. However, nobodyprevents
> you from using ResultSet.getBytes(int) method and you will get the rawJDBC
> data.
>
> > I'm using JayBird through 3rd party Java application Kettle
> > (kettle.javaforge.com) which supports JDBC connections. With MySQL
> > driver I have no problem, VARBINARY(n) column type is readed asbyte[].
>Firebird
> VARBINARY is not VARCHAR CHARACTER SET OCTESTS. And unfortunately
> does not support VARBINARY type...CHAR(n)
>
> > The second question is: is there any way to read data defined as
> > CHARACTER SET NONE as binary data? I don't want JayBird or JVM to makespecify
> > any character conversions when reading/writting data.
>
> Use the ResultSet.getBytes(int) method and ensure that you do not
> connection charSet or encoding.
>
> Roman
>