943,824 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 749
  • Java RSS
Mar 31st, 2009
-1

resultSet and unicode problem

Expand Post »
Hi guys,
how to read a unicode characters (arabic characters) form ResultSet object which appears after extraction as question marks like this(?????) i've tried to use the "getUnicodeStream()" method and "getCharacterStream()" method but both leads to the same results, does anyone have a workaround to this problem.

Thanks in advance.

Here's the code below:

Java Syntax (Toggle Plain Text)
  1. package dbWordsPackage;
  2. import java.io.*;
  3. import java.sql.*;
  4. import javax.swing.JOptionPane;
  5.  
  6. /**
  7.  *
  8.  * @author EL-Prince
  9.  */
  10. public class dbWordsCon {
  11.  
  12. public String URL = "jdbc:odbc:dbWords";
  13. public String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
  14.  
  15. public Connection Con = null;
  16. public Statement Stmnt = null;
  17. public ResultSet rs = null;
  18.  
  19. public dbWordsCon(){
  20.  
  21. try{
  22. Class.forName(this.Driver);
  23. this.Con = DriverManager.getConnection(URL);
  24. this.Stmnt = this.Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
  25. ResultSet.CONCUR_UPDATABLE);
  26.  
  27. String sqlQuery = "SELECT * FROM words" ;
  28. rs = Stmnt.executeQuery(sqlQuery);
  29.  
  30. String result = null;
  31.  
  32. while(rs.next()){
  33.  
  34. BufferedReader r = new BufferedReader(rs.getCharacterStream(3));
  35. JOptionPane.showMessageDialog(null, r.readLine());
  36. }
  37. }catch(SQLException ex) {
  38. ex.printStackTrace();
  39. } catch (ClassNotFoundException e ) {
  40. e.printStackTrace();
  41. }catch(Exception exp){
  42. exp.printStackTrace();
  43. }// End of catch
  44. }// End of constructor
  45.  
  46. }
Last edited by peter_budo; Apr 1st, 2010 at 2:48 pm. Reason: Fixing code tags on old thread
Reputation Points: 8
Solved Threads: 3
Junior Poster
MxDev is offline Offline
137 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Try-Catch block problem
Next Thread in Java Forum Timeline: Help in making Simple Screen Saver





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC