<< Back to previous view

[JDBC-39] Boolean - BIT(1) - columns are returned as byte[] via some DB connections Created: 10/Sep/12  Updated: 06/Aug/13  Resolved: 12/Sep/12

Status: Resolved
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sean Corfield Assignee: Sean Corfield
Resolution: Declined Votes: 0
Labels: None
Environment:

Specifically using the MySQL connector 5.0.x or 5.1.x against a Tungsten Connector proxy



 Description   

The root cause appears to be that rs.getObject( i ) seems to take the field flags into effect over the basic java.sql.Types values.

In this case a BIT(1) column comes back from MySQL as type 16 (BOOLEAN), flags UNSIGNED. From Tungsten it comes back as type 16, flags BINARY BLOB UNSIGNED.

The resultset-seq construction code is pretty cavalier about using just getObject() instead of more specific types so this might be the start of a smarter approach to that.



 Comments   
Comment by Sean Corfield [ 10/Sep/12 5:51 PM ]

Further update: this looks to be a configuration or version issue with the Tungsten Connector setup as we've been able to repro the problem in one environment but it works as expected in a newer environment.

May still go ahead with this change anyway since I believe it's a good change for robustness, but it looks lower priority right now.

Comment by Sean Corfield [ 10/Sep/12 6:51 PM ]

Pushed a fix for this but would like more hands on this in SNAPSHOT form before declaring it resolved.

Comment by Sean Corfield [ 10/Sep/12 7:46 PM ]

Tungsten's Connector defeats this fix. Even tho' the fields have an underlying mysqlType value of 16 (BOOLEAN), (.getColumnType) returns -3 (byte[] presumably) so Boolean is not forced as I had hoped.

Comment by Sean Corfield [ 12/Sep/12 7:51 PM ]

The underlying behavior is a quirk of the Tungsten Connector configuration which we believe we've successfully corrected. Given the result of (.getColumnType) is -3, I'm not sure anything could be done in code to address this, so I'm going to resolve this as invalid.

Comment by Sean Corfield [ 12/Sep/12 7:52 PM ]

Not a code issue.

Comment by Sean Corfield [ 06/Aug/13 6:16 PM ]

In case anyone else runs into this with Tungsten: BIT fields are handled in a version-specific way and the logic assumes three segments to the version number. Tungsten's default configuration has only two segments in the version number so the BIT handling logic barfs. The workaround is to change the Tungsten configured version to match the actual MySQL version you are proxying (e.g., 5.5.30-percona instead of 5.1-tungsten).

Generated at Mon Oct 20 06:26:31 CDT 2014 using JIRA 4.4#649-r158309.