This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read char() for bit data DB2's type in Java?

 
Monica Ruiz
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to read a DB2's field with the "char() for bit data" type from Java.
I have trying with the following options:
rset.getString(1) --> C8D1C14040404040404040404040404040404040 --> (Hexadecimal representation)
rset.getObject(1) -->[B@1a786c3
rset.getBinaryStream(1) --> java.io.ByteArrayInputStream@1a786c3
rset.getAsciiStream(1) --> java.io.ByteArrayInputStream@2bb514
rset.getCharacterStream(1) -->java.io.StringReader@1a786c3

And other option was to add in JDBC URL:
translate binary=true;

But none of them return me correctly the value of the field.

Any idea?

Thank you and regards.
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see you are also discussing this here.

Please follow this advise if you post the same question on several fora:
Be Forthright When Cross Posting To Other Sites
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and Welcome to JavaRanch, Monica!
 
Monica Ruiz
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jan,

I thought it will be not a problem if I post my problem in various forums... I am not so sure if it is a database or Java issue.

Regards
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monica Ruiz wrote:Hi Jan,

I thought it will be not a problem if I post my problem in various forums... I am not so sure if it is a database or Java issue.

Regards
You have choosen the right forum.
 
Flaz Four
Greenhorn
Posts: 7
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works for Apache Derby ver. 10.10.1.1
There are not options specified in JDBC url.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic