Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-253

Text encoding concorrect on blob column

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.3, 1.3.4, 1.3.5
    • Fix Version/s: 1.3.6
    • Component/s: Failover
    • Labels:
      None
    • Environment:
      WINDOWS

      Description

      public class Test1 {

      @Test
      public void test() throws SQLException {
      try (Connection conn = DriverManager.getConnection("jdbc:mariadb://localhost/test?characterEncoding=UTF-8", "root", "root")) {
      conn.prepareStatement("CREATE TABLE table1 (column1 blob ) DEFAULT CHARSET=utf8").execute();
      String str = "\u4f60\u597d(hello in Chinese)";
      try {
      try (PreparedStatement ps = conn.prepareStatement("insert into table1 values"))

      { ps.setString(1, str); ps.executeUpdate(); }

      try (PreparedStatement ps = conn.prepareStatement("select * from table1");
      ResultSet rs = ps.executeQuery()) {
      while (rs.next())

      { String tmp = rs.getString(1); assertEquals(tmp, str); }

      }
      } finally

      { conn.prepareStatement("DROP TABLE IF EXISTS table1").execute(); }

      }
      }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              diego dupin Diego Dupin
              Reporter:
              zhanhb zhanhb
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration