Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not find UTF-8 string in Database

 
sudip debnath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What's the encoding of the database ?
2. Can you retrieve the data using SqlPlus ?
 
sudip debnath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the DB encoding is AL32UTF8
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about the second question ? You need to know whether the data already in the db is correct or not.
 
sudip debnath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya, the record could be fetched through direct query.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the JDBC Statement you are using to retrieve this value ?
 
sudip debnath
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You checked that the content of strSearchKey is correct, right ? If so, are you using the latest Oracle 10g JDBC driver ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic