File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Clob Cyrillic woes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Clob Cyrillic woes" Watch "Clob Cyrillic woes" New topic

Clob Cyrillic woes

Ken Sloane

Joined: Oct 24, 2005
Posts: 2
I was wondering if anyone knew what was going on? I'm having trouble retrieiving Cyrillic characters from a Clob data type from an Oracle 10g database. Using iSQL*Plus web interface I insert Cyrillic text into the database and verify that it looks ok by doing a select on those rows.

In my code, when I attempt to retrieve the data I get a string of question marks. Western European characters seem to work fine.

The code is as follows (I've tried many different methods):

Clob clob = (Clob)(resultSet).getClob(column);
char buffer[] = new char[1];
BufferedReader reader = new BufferedReader(clob.getCharacterStream());
while ( != -1) {
data += new String(buffer);
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

When you see ??? instead of the characters you expected to see, that's a sign that the wrong encoding (charset) is being used to convert bytes to chars at some point. Now, you are using getCharacterStream(), so it's the database driver that is returning characters (not bytes) to your program. And it's not converting them correctly.

So probably the solution is to configure the database driver, or the database, to use the correct encoding. You'd have to check the Oracle documentation (or the driver documentation if it isn't an Oracle driver) to find out how to do that.
Ken Sloane

Joined: Oct 24, 2005
Posts: 2
I'll look at the driver (we're using ojdbc14.jar) and at the database. Thanks. I'll start there.
I agree. Here's the link:
subject: Clob Cyrillic woes
It's not a secret anymore!