resultSet and unicode problem

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2007
Posts: 85
Reputation: MxDev has a little shameless behaviour in the past 
Solved Threads: 2
MxDev MxDev is offline Offline
Junior Poster in Training

resultSet and unicode problem

 
-1
  #1
Mar 31st, 2009
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:

package dbWordsPackage;
import java.io.*;
import java.sql.*;
import javax.swing.JOptionPane;

/**
*
* @author EL-Prince
*/
public class dbWordsCon {

public String URL = "jdbc:odbc:dbWords";
public String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";

public Connection Con = null;
public Statement Stmnt = null;
public ResultSet rs = null;

public dbWordsCon(){

try{
Class.forName(this.Driver);
this.Con = DriverManager.getConnection(URL);
this.Stmnt = this.Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);

String sqlQuery = "SELECT * FROM words" ;
rs = Stmnt.executeQuery(sqlQuery);

String result = null;

while(rs.next()){

BufferedReader r = new BufferedReader(rs.getCharacterStream(3));
JOptionPane.showMessageDialog(null, r.readLine());
}
}catch(SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException e ) {
e.printStackTrace();
}catch(Exception exp){
exp.printStackTrace();
}// End of catch
}// End of constructor

}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum


Views: 341 | Replies: 0
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC