Uploaded image for project: 'Apache Trafodion'
  1. Apache Trafodion
  2. TRAFODION-972

LP Bug: 1416568 - t2 - ucs2 char data is not returned correctly

    XMLWordPrintableJSON

    Details

      Description

      T2 driver inserts ucs2 char data correctly, but select is not ok. sqlci returns it correctly.

      Output from t2 test (shows up as chinese on linux):

      [trafodion@n013 basict2]$ java -Dprop=t2prop testucs2
      Connecting to database...
      Table created
      Data inserted
      1, \u4d00\u6f00\u6500\u2000\u2000\u2000\u2000\u2000\u2000\u2000\u2000\u2000
      1 rows selected
      Done

      From sqlci:
      >>select * from testucs2;

      C1 C2
      ----------- ------------------------

      1 Moe

      — 1 row(s) selected.
      >>

      Test code:

      public class testucs2
      {
      public static void main(String[] args) throws SQLException, ClassNotFoundException
      {

      Connection conn = null;
      Statement stmt = null;
      ResultSet rs = null;
      String sql = "create table testucs2 (c1 int not null primary key, c2 char(12) character set ucs2 default null)";
      int rowNo = 0;

      try
      {
      System.out.println("Connecting to database...");
      Class.forName("org.trafodion.jdbc.t2.T2Driver");
      conn = DriverManager.getConnection("jdbc:t2jdbc:", "usr", "pwd");
      stmt = conn.createStatement();
      stmt.executeUpdate("drop table if exists testucs2");
      stmt.executeUpdate(sql);
      System.out.println("Table created");
      stmt.executeUpdate("insert into testucs2 values(1, 'Moe')");
      System.out.println("Data inserted");
      rs = stmt.executeQuery("select * from testucs2");
      rowNo = 0;
      while (rs.next())

      { rowNo++; System.out.println(rs.getObject(1) + ", " + rs.getObject(2)); }

      rs.close();
      System.out.println(rowNo + " rows selected");
      System.out.println("Done");
      stmt.close();
      conn.close();
      } catch (SQLException e)

      { System.out.println("Exception : " + e.getMessage()); e.printStackTrace(); return; }

      }
      }

        Attachments

          Activity

            People

            • Assignee:
              omanski Zbigniew Omanski
              Reporter:
              saruna Aruna Sadashiva
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: