| | |
resultSet and unicode problem
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2007
Posts: 76
Reputation:
Solved Threads: 2
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
}
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
}
![]() |
Other Threads in the Java Forum
- Previous Thread: Try-Catch block problem
- Next Thread: Help in making Simple Screen Saver
| Thread Tools | Search this Thread |
Tag cloud for Java
android api appinventor apple applet application arc arguments array arrays automation binary bluetooth c++ chat class classes client code codesnippet compiler component csv database doctype draw ebook eclipse error event exception fractal freeze game givemetehcodez graphics gui html ide image input integer intellij iphone j2me java java.xls javaprojects jni jpanel julia linux list login loop loops mac map method methods mobile netbeans newbie number online oracle page parameter print problem program programming project recursion reporting rotatetext scanner screen server set size sms socket sort sourcelabs sql string superclass swing system template test testautomation threads time title tree tutorial-sample windows working





