Ahmad Safri

Greenhorn
+ Follow
since Dec 15, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ahmad Safri

Hi all,
Thank you for all your replies. Here is my code...
**************************************************
import java.sql.*;
import java.io.*;
import java.util.*;
public class StreamConverter {
static void writeOutput(byte[] str) {
try {
FileOutputStream fos = new FileOutputStream("test.txt");
Writer out = new OutputStreamWriter(fos, "UTF-8");
fos.write(str);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}

catch (java.lang.ClassNotFoundException e)
{
System.out.println("Rosak - tak jumpa class(jdbc driver): " + e.getMessage());
}

// Open the datasource
try
{
Properties prop = new java.util.Properties();
prop.put("useUnicode", "true");
prop.put("characterEncoding", "UTF-8");

String url = "jdbc:odbc:cina";

Connection con = DriverManager.getConnection(url, prop);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet rec = stmt.executeQuery ("SELECT * FROM Test");

while(rec.next()) {

String xx = new String(rec.getString("question"));
byte ucode[] = xx.getBytes("UTF-8");
System.out.println("This is byte ucode: "+ucode);
String Display = new String(ucode, "UTF-8");

writeOutput(ucode);
}

stmt.close();

} catch (SQLException s) {
System.out.println("Error s DBase --> " + s.toString() + " " + s.getErrorCode() + " " + s.getSQLState());

}catch (Exception e) {
System.out.println("Error e DBase -->" + e.toString() + e.getMessage());
}
}
}
**************************************************
Can anyone please.... tell me what's wrong with it....
I thank you in advance.
[ December 25, 2002: Message edited by: Ahmad Safri ]
21 years ago
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks
21 years ago
Hi all,
I really need your help. How do I retrieve chinese characters from MS Access 2000? I've been going through the forum..but can't really find one that can help me.
Thanks
21 years ago