aspose file tools*
The moose likes JDBC and the fly likes Could not find UTF-8 string in Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Could not find UTF-8 string in Database" Watch "Could not find UTF-8 string in Database" New topic
Author

Could not find UTF-8 string in Database

sudip debnath
Greenhorn

Joined: May 31, 2010
Posts: 4
Hi all,
we have fields containing chinese characters in our database table (Oracle 10G). From the UI, we are sending chinese character to JAVA code and trying to look-up against the table column using JNDI-JDBC connection pooling but are unable to fetch any record. Could anyone help me in this issue? I suspect, encoding might be the culprit.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

1. What's the encoding of the database ?
2. Can you retrieve the data using SqlPlus ?


[My Blog]
All roads lead to JavaRanch
sudip debnath
Greenhorn

Joined: May 31, 2010
Posts: 4
the DB encoding is AL32UTF8
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

What about the second question ? You need to know whether the data already in the db is correct or not.
sudip debnath
Greenhorn

Joined: May 31, 2010
Posts: 4
Ya, the record could be fetched through direct query.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Can you show the JDBC Statement you are using to retrieve this value ?
sudip debnath
Greenhorn

Joined: May 31, 2010
Posts: 4

it's like:
strBankBranchCodes = "SELECT bank_code, bank_name, branch_code, branch_name FROM BRANCHTABLE ";
strBankBranchCodes += "WHERE UPPER(bank_name) LIKE '%" + strSearchKey +"%' OR UPPER(branch_name) LIKE '%" + strSearchKey+ "%'";
.......
stmt = conn.createStatement();
rs = stmt.executeQuery(strBankBranchCodes);
where strSearchKey is the Chinese string coming in from the user.
BRANCHTABLE is a synonym to an actual table.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You checked that the content of strSearchKey is correct, right ? If so, are you using the latest Oracle 10g JDBC driver ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not find UTF-8 string in Database