t2 - ucs2 char data is not returned correctly

Bug #1416568 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Committed
High
Zbigniew Omanski

Bug 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;
       }
     }
}

Changed in trafodion:
assignee: nobody → Zbigniew Omanski (zbigniew-omanski)
status: New → Confirmed
Changed in trafodion:
status: Confirmed → In Progress
Changed in trafodion:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.