| | |
resultSet and unicode problem
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2007
Posts: 85
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
Views: 341 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application arguments array arrays automation binary bluetooth c# capture chat chatprogramusingobjects class classes client code color component count database design draw eclipse eclipsedevelopment encryption error event exception file fractal game givemetehcodez graphics gridlayout gui helpwithhomework high html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jmf jni jpanel julia keyword linux list loop macintosh map method methods mobile multithreading netbeans newbie number object oracle os print problem producer program programming project projectideas read recursion replaysolutions scanner screen server set size sms socket sort sql string swing test threads time transfer transforms tree unicode windows





