[CONJ-253] Text encoding concorrect on blob column Created: 2016-02-13  Updated: 2019-05-12  Resolved: 2016-02-21

Status: Closed
Project: MariaDB Connector/J
Component/s: Failover
Affects Version/s: 1.3.3, 1.3.4, 1.3.5
Fix Version/s: 1.3.6

Type: Bug Priority: Minor
Reporter: zhanhb Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

WINDOWS


Issue Links:
Relates
relates to CONJ-369 Encoding on clob column Closed

 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(); }

}
}
}



 Comments   
Comment by Diego Dupin [ 2016-02-21 ]

hi, you're right.

correction done with commit : https://github.com/MariaDB/mariadb-connector-j/commit/123f02ab97c6baddc934baa4886133841f944a6b
in next version 1.3.6 ( release in a few days)

Generated at Thu Feb 08 03:14:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.