MySQL Forums
Forum List  »  Connector/JDBC and Java

Re: Unable to retrieve unicode data
Posted by: Leonard Fernandes
Date: April 26, 2012 12:00AM

I have isolated this as probably being a JDBC issue.

After I removed
keyword = new String(keyword.getBytes("ISO-8859-1"), "UTF-8");
and used the keyword directly, I got some results. But it is not consistent and I sometimes get and sometimes don't

Can you help me?

The code is below:

/*try {keyword = new String(keyword.getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException usee){keyword = "";}*/

keyword = Utilities.replaceQuotes(keyword);

String sequel = "SELECT book_name, book_isbn FROM book_resource_view WHERE MATCH(book_name, book_isbn, bookauthor) AGAINST ('"+keyword+"') ";

Connection objConn = null;
Statement state = null;
ResultSet results = null;
ConnectionPool connectionPool = null;

try {
connectionPool = new ConnectionPool(10, 50, true);
state = objConn.createStatement();

String query = "set names utf8";

//query = "set character set utf8";

results = state.executeQuery(sequel);

Options: ReplyQuote

Written By
Re: Unable to retrieve unicode data
April 26, 2012 12:00AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.