MySQL driver - Wrong object type returned by resultSet.getMetaData()

Description

The following code works as expected with (MySQL driver) version 5.1.40, but fails with 8.0.15. This code works as expected with ACF (using the 8.0.15 drivers), so it appears that the problem is in the Lucee-specific bundle. The SQL is completely arbitrary, change the 'testDSN' value to match an available MySQL datasource

SQL = "select * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_schema = DATABASE() AND constraint_name = 'Primary'";
testDSN = "mySqlTest";

factory = CreateObject("java", "coldfusion.server.ServiceFactory");
dsservice = factory.getDataSourceService();
dsn = dsservice.getDataSource(testDSN);
jConn = dsn.getConnection();
statement = jConn.createStatement();
resultSet = statement.executeQuery(PreserveSingleQuotes(SQL));
// NOTE - another bug found here - if you insert a WriteDump(resultSet) here, the state of the resultSet object is changed so the following getMetaData() call fails - I'm not writing this up separately because this is pretty obscure, but it is worth a mention.
rsm = resultSet.getMetaData();
writeDump(rsm); // class is 'com.mysql.cj.result.DefaultColumnDefinition', should be ResultSetMetadata
// comment out the following to avoid crash
colCount = rsm.getColumnCount();
WriteOutput("column count: #colCount#<br />");

Environment

CentOS 7 (VirtualBox VM), Java 11.0.3 (JVM included with Lucee distribution)

Assignee

Michael Offner

Reporter

Tim Parker

Priority

Major

Labels

None

Fix versions

Affects versions

Configure