This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes JDBC and DB2 Char(n) FOR BIT DATA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC and DB2 Char(n) FOR BIT DATA" Watch "JDBC and DB2 Char(n) FOR BIT DATA" New topic
Author

JDBC and DB2 Char(n) FOR BIT DATA

john jillella
Greenhorn

Joined: Sep 23, 2009
Posts: 3
Guys,
I have problem calling a Db2 pl/sql procedure which accepts char(n) for bit data.

Please let know suitable cs.setXXX method and corresponding JDBC datatype. An example is appreciated. Thank you
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

Have you tried setString()?


[OCA 8 Book] [Blog]
john jillella
Greenhorn

Joined: Sep 23, 2009
Posts: 3
Scott Selikoff wrote:Have you tried setString()?


Yes, I tried setString but doesn't work. Thanks.
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

How about setBytes or setCharacterStream? I would just go through the ResultSet API and try the ones related to characters/string. Otherwise check the DB2 JDBC documentation and see if nchar is an unsupported type, although I doubt it's not supported.
john jillella
Greenhorn

Joined: Sep 23, 2009
Posts: 3
Scott Selikoff wrote:How about setBytes or setCharacterStream? I would just go through the ResultSet API and try the ones related to characters/string. Otherwise check the DB2 JDBC documentation and see if nchar is an unsupported type, although I doubt it's not supported.


I tried using setBytes. i'll try again tomorrow. In Db2 database it is shown as a binary value.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC and DB2 Char(n) FOR BIT DATA
 
It's not a secret anymore!