This is a question of inserting i18n code to database. I placeed this
question in servlet_users yesterday, again I hope someone help me.

I can select the 16-bit code from the database, but I can not insert the
16-bit code to database (Interbase). This seems to be a jdbc or database
problem . I compile the source with command:
"javac -encoding GB2321 InsertCC.java ", but painful still is me. give help
?

Thanx in advance.

jacky


------------------------------------------------------------------------

  String url = "jdbc:odbc:gsd";
  Connection con;
  Statement stmt;

  String id = 1;
  String f1 ="abc";
  String f2 ="����";

  String sql ="";
  sql = sql + "INSERT INTO tablename VALUES (";
  sql = sql + id;
  sql = sql + ",'" + f1;
  sql = sql + "','" + f2;
  sql = sql + "')";

  try {
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  } catch(java.lang.ClassNotFoundException e) {
   System.err.print("ClassNotFoundException: ");
   System.err.println(e.getMessage());
  }
  try {
   con = DriverManager.getConnection(url, "SYSDBA", "masterkey");
   stmt = con.createStatement();
   stmt.executeUpdate(sql);
   stmt.close();
   con.close();
  } catch(SQLException ex) {
   System.err.println("SQLException: " + ex.getMessage());
   }

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to