jdbc-odbc至今仍无解决中文问题的方法。找一个access的pure java驱动看看。

解决方案 »

  1.   

    我也碰到JDBC不支持中文的事,哪位仁兄可以解决?
      

  2.   

    Now I have a way of solute chinese problem in java 
    (include jdbc-odbc bridge but as if only fit jdk 1.1.* and 1.0.*)
    the way is using encoding way.the "iso-8859-1" encoding is the most wide english encoding solution
    supposing the chinese data is readed from file or database in String "sChData",
    you must deal with the following code 
          " byte[] ch_byte = sChData.getBytes("iso-8859-1");
           //here we force java vm to read chinese data in a english way
           sChData = new String(ch_byte);       
           //and here we force to turn into unicode data",in addition, when data writed to file or db , and use the following code
          " byte[] ch_byte = sChData.getBytes();        
          //here we divide the string into byte array        
          sChData = new String(ch_byte,"iso-8859-1");        
          //and here we force to turn to the english way from
          //  the unicode byte array" if you want to send data among threads, please use Reader/writer
    in jdk 1.1.* or jdk 1.2.* to send the unicode data which are dealt 
    with the first way;the way fit in all java editions except for jdbc in jdk1.2
    (it is only now I have not solutions.)My code is here (use chinese params of sql to 
     read the chinese data from database):(environment :visualage for java 2.0)import java.sql.*;
    /**
     * This type was created in VisualAge.
     */
    class MyTest {
    /**
     * This method was created in VisualAge.
     * @param args java.lang.String[]
     */
    public static void main(String args[]) {
    Connection con = null;
    Statement myState = null;
    ResultSet myRSet = null;
    String url, sName;
    try {
    url = "jdbc:odbc:paper";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(url, "", "");
    myState = con.createStatement();
    String sql = "select paperName from paper where author = \'张三\'";
    byte[] ch_Byte = sql.getBytes();
    sql = new String(ch_Byte,"iso-8859-1");
    myRSet = myState.executeQuery(sql);
    while (myRSet.next()) {
    sName = myRSet.getString("paperName");
    ch_Byte = sName.getBytes("iso-8859-1");
    sName = new String(ch_Byte);
    System.out.println("Name: " + sName);
    }
    } catch (Exception e) {
    System.out.println("error: " + e.toString());
    }
    }
    }please send some scores to me!
    it spends a week for me !! 
           ^v^
      

  3.   

    I am hungry for your scores.^o^ 
      

  4.   

    有同感,使用JDK1.1.5质量就比较高。