wood burning stoves 2.0*
The moose likes Java in General and the fly likes Help to retrieve Chinese characters from MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help to retrieve Chinese characters from MS Access " Watch "Help to retrieve Chinese characters from MS Access " New topic
Author

Help to retrieve Chinese characters from MS Access

Ahmad Safri
Greenhorn

Joined: Dec 15, 2002
Posts: 3
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


Big E
girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 97
Hi safri,
Im not sure of this, but setting the character set to UTF-8 should work, or may b UTF-16???

Have u added the chinese font support for your OS?


Girish
Ahmad Safri
Greenhorn

Joined: Dec 15, 2002
Posts: 3
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Originally posted by Safri:
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks

In my experience, to view Chinese characters, you have to have some Chinese viewing software installed, and run the program before you can read Chinese.
And also remember there are many kinds of Chinese characters out there: big5, GB, ...
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Link on adding Chinese fonts to the J2SE Platform.
Also Safri,
Welcome to JavaRanch,
we hope you’ll enjoy visiting as a regular however, your name is not in keeping with our naming policy
here at the ranch. Please change your display name to an appropriate name as shown in the policy.
You can change your profile here.
Thanks again and we hope to see you around the ranch!!
Cindy


"JavaRanch, where the deer and the Certified play" - David O'Meara
Ahmad Safri
Greenhorn

Joined: Dec 15, 2002
Posts: 3
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 = "jdbcdbc: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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help to retrieve Chinese characters from MS Access