While upgrading ETL scripts for Mysql 5.8
to MySQL8
upgrade, as soon as I have updated the data-integration/lib
jar to mysql-connector-java-8.0.xx.jar
, it has started blowing with following error
.
Driver class 'org.gjt.mm.mysql.Driver' could not be found, make sure the 'MySQL' driver (jar file) is installed.
I did spent lot of time debugging and finally concluded, two things, I hope this may save others time in similar situation.
Reason: There is hardcoded
jdbc driver name in org.pentaho.di.core.database.MySQLDatabaseMeta
, and it always returns org.gjt.mm.mysql.Driver
which is removed and new Driver
with name com.mysql.jdbc.Driver
or com.mysql.cj.jdbc.Driver
should be used.
Solutions Any of below should be done to resolve.
Continue using the old jdbc
jar.
Modify the org.pentaho.di.core.database.MySQLDatabaseMeta
below method, compile and place it in classes
directory.
public String getDriverClass() {
if (getAccessType()==DatabaseMeta.TYPE_ACCESS_ODBC)
{
return "sun.jdbc.odbc.JdbcOdbcDriver";
}
else
{
return "com.mysql.cj.jdbc.Driver";
} }
Use the Generic database connection, then you can specify the driver class yourself. (Based on @Cyrus comment.)
Pentaho open bug reference.