| Bug #8233 | Encoding is always null in Connection.execSQL method | ||
|---|---|---|---|
| Submitted: | 1 Feb 2005 9:17 | Modified: | 1 Feb 2005 14:12 |
| Reporter: | Victor Pyankov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 3.1.6 | OS: | Any (All) |
| Assigned to: | CPU Architecture: | Any | |
[1 Feb 2005 9:20]
Victor Pyankov
ConnectionProperties.java (fixed)
Attachment: ConnectionProperties.java (application/octet-stream, text), 88.98 KiB.
[1 Feb 2005 14:12]
Mark Matthews
You are correct. Connection.setDoUnicode() should not be used, Connection.setUseUnicode() is the correct method. The setDoUnicode() method will be removed for 3.1.7.

Description: For MySql 4.1.8 we use ConnectionProperties.setUseUnicode method (see com/mysql/jdbc/Connection.java, line 2870). For MySql 4.0.x we use ConnectionProperties.setDoUnicode method (see com/mysql/jdbc/Connection.java, line 2687 and 2716). Unfortunately, setDoUnicode metod is lacking following line: this.useUnicodeAsBoolean = this.useUnicode.getValueAsBoolean(); As result encoding is always null in Connection.execSQL method (see com/mysql/jdbc/Connection.java, line 2288) for MySql server 4.0.x, Connector/J 3.1.6 and cp1251 charset on server. How to repeat: See mentioned source code. Suggested fix: Add line to setDoUnicode method: /** * DOCUMENT ME! * * @param property */ protected void setDoUnicode(boolean property) { this.useUnicode.setValue(property); // addition beg this.useUnicodeAsBoolean = this.useUnicode.getValueAsBoolean(); // addition end } (see also attached file) May be it is possible to use only setUseUnicode?