Additional SQL Data Types
The connector supports additional SQL data types, such as IPADDRESS, IPPREFIX, UUID, HYPERLOGLOG, KHYPERLOGLOG, P4HYPERLOGLOG, and QDIGEST.
IPADDRESS, IPPREFIX, and UUID data can also be bound in prepared statements. HYPERLOGLOG, KHYPERLOGLOG, P4HYPERLOGLOG, and QDIGEST are not supported with parameterized queries in prepared statements.
For information about additional data types, see the following:
IPADDRESS, IPPREFIX, and UUID
For example, to pass IPADDRESS data in a prepared statement, use the following syntax:
preparedStatement.setObject(1, "10.54.3.10", Types.JAVA_OBJECT);
For example, to pass IPPREFIX data in a prepared statement, use the following syntax:
preparedStatement.setObject(1, "10.54.3.10/24", Types.JAVA_OBJECT);
For example, to pass UUID data in a prepared statement, use the following syntax:
preparedStatement.setObject(1, "12151fd2-7586-11e9-8f9e-2a86e4085a59", Types.JAVA_OBJECT);
Other Data Types
Other SQL data types that are mapped to the Java SQL type VARCHAR are returned as a STRING representation of the returned value.
For example:
INTERVAL DAY TO SECOND
Query: SELECT INTERVAL '2' DAY.
Connector Result: A STRING with the value 2 00:00:00.000.
INTERVAL YEAR TO MONTH
Query: SELECT INTERVAL '3' MONTH.
Connector Result: A STRING with the value 0-3.
TIMESTAMP WITH TIMEZONE
Query: SELECT TIMESTAMP '2001-08-22 03:04:05.321 America/Los_Angeles'.
Connector Result: A STRING with the value 2001-08-22 03:04:05.321 America/Los_Angeles.
TIME WITH TIMEZONE
Query: SELECT TIME '01:02:03.456 America/Los_Angeles'.
Connector Result: A STRING with the value 01:02:03.456 America/Los_Angeles.
JSON
Query: SELECT CAST('{\"id\": 1, \"name\": \"test\"}' as json).
Connector Result: A STRING with the value "{\"id\": 1, \"name\": \"test\"}".