A query on a MySQL table containing a NULL value in a BIT column fails with an error

A query on a MySQL table containing a NULL value in a BIT column fails with an error

book

Article ID: KB0076643

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization 7.0.x and higher

Description

A query to a MySQL table containing a NULL value in a BIT column fails with:

-------------
Caused by: Unable to get value at position "1" with datatype "BIT".  [data-2923070]
at com.compositesw.cdms.ds.jdbc.JdbcConnectionTableCursor.setColumnValue(JdbcConnectionTableCursor.java:561)
at com.compositesw.cdms.ds.mysql.MySqlConnectionTableCursor.next(MySqlConnectionTableCursor.java:155)
... 10 more
Caused by: java.lang.NullPointerException
at com.mysql.jdbc.ResultSetImpl.getNumericRepresentationOfSQLBitType(ResultSetImpl.java:4936)
at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2666)
------------------

Issue/Introduction

A query on a MySQL table containing a NULL value in a BIT column fails with: Unable to get value at position "1" with datatype "BIT"

Resolution

There is is a known bug (# 83662) in MySQL JDBC driver versions 5.1.40 and 5.1.41 can cause this  issue.  Therefore, find out what driver version your MySQL data source is using.

Example
dir C:\apps\tdv707\conf\adapters\system\mysql_5_5
mysql-connector-java-5.1.40-bin.jar

In the above example, the MySQL JDBC driver version is 5.1.40. 

Follow the steps below to resolve the issue:

1.  Download the latest MySQL driver jar file from the MySQL site.

2.  Shut down the TDV server ( it is okay to leave the Repository and the Cache running).

3.  Back up the existing jar MySQL driver jar and replace it with the downloaded file.

4.  Start the TDV server.