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

Text encoding concorrect on blob column

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.3.3, 1.3.4, 1.3.5
    • 1.3.6
    • Failover
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.