Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

arabic encoding problem Connection Between mysql and java

807580May 21 2010 — edited May 22 2010
i have problem i try to print arabic name from mysql
but it print it as ?????
and the same happen while i'm saving to database form textbox it appear in the db like this ?????
i add in the connection property encoding but i still have the same problem
i'm using jdbc /odbc
plz i need help

this is my code

--------------------------------------------------------------------------------

Properties prop = new Properties();
prop.put("user", "resa");
prop.put("password", "mypassword");
prop.put("useUnicode", "yes");
prop.put("characterEncoding", "UTF-8");
Connection con = DriverManager.getConnection("jdbc:odbc:resa",prop);
Statement stmt = con.createStatement();
String queryString = new String("select * from test_arab");
ResultSet rs = stmt.executeQuery(queryString);
while(rs.next())
{
int myId = rs.getInt("id");
String temp= rs.getString("arab_name");
System.out.println(new String(temp.getBytes("UTF-8")));
}

--------------------------------------------------------------------------------
thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2010
Added on May 21 2010
3 comments
642 views