Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert non-English into Oracle DB?

Status
Not open for further replies.

volcano

Programmer
Aug 29, 2000
136
HK
hello, I have written a simple Java application which will insert Chinese into my Oracle table. However when I retrieve the data, I just see unreadable words. Do you think what I should modify my program so that I can acheive my objective? Thanks for your help!

-------------- Sample Code -----------------------
public class TEST {
public static void main(String[] args) throws Exception{
String cs = "XXXXXXXXX"; // some Chinese here

try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("Driver found...");
Connection conn = DriverManager.getConnection("jdbc:eek:racle:thin:mad:XXX:XXX
:XXX", "XXX", "XXX");

Statement sql = conn.createStatement();
sql.execute("insert into greeting (content) values ('" + cs + "')");
}
catch (Exception e) {
System.out.println("Insert DB error:" + e);
}
}
}
 
you have to setup the language properly in Oracle database, as far as I know. Since the default language is English, some parameters have to be set to enable this feature.

Then, write some test pl/sql codes and try to insert some chinese chars using unicode. If you're able to do it from here, then there should not be any problems passing the unicode from the web/java screens to your middle tier -> db.

~za~
You can't bring back a dead thread!
 
yes, you have to enable Oracle for UTF-8 support.
Either that or use a BLOB field to store the data, which is slow and cumbersome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top