Database driver registration problem (Knime 2.7 batch mode)

Since upgrading to Knime 2.7 (using Linux version) I have trouble running workflows which include database connections (MySQL and Oracle using JDBC driver) in batch mode. The same workflows run fine when starting them interactively from Knime UI, but when running from command line I get error messages like:

ERROR Database Reader Execute failed: org.knime.core.node.InvalidSettingsException: Could not register database driver "oracle.jdbc.OracleDriver", reason: oracle.jdbc.OracleDriver

Example command line that I am using to run a workflow:

knime -batch -reset -workflowDir=/path/to/knime_workspace/myworkflow -credential="my_credentialname;my_username;my_passwd" -nosave

I read in the changelog that some things have changed regarding database driver registration, is there a new setting I should pass to Knime when running the workflow or some other recommended way to work around this problem?

BR, Julius

Hi Julius, this refers to issue #2110 that we needed to change with KNIME 2.7.0. Before KNIME 2.1, the driver location was assigned in the Database node dialog, this has changed with 2.1 since then we had the driver location stored in the node settings and in the preferences. With the newest version the driver is only available in the preferences. The solution is to export the preferences from KNIME UI and use -preferences to point to the exported preferences file when running KNIME workflow in batch mode. Sorry for the hassle, but this is the cleanest way as of KNIME 2.7.0.

Great, thanks Gabriel for the prompt reply. Using -preferences worked for me.


I have a similar problem with KNIME 2.7.2.

The simple batch mode call via console works fine with the preferences. 

Now I have an OSGi-Service, which takes the URI of a zipped stream as parameter. The stream is executed but without the database nodes. The OSGi-Console reports:

'WARN Database Reader java.sql.SQLException: org.knime.core.node.InvalidSettingsException: Could not register database driver "com.mysql.jdbc.Driver", reason: com.mysql.jdbc.Driver'

Sounds like the mysql database driver is not registered. If you manage to get the driver somehow registered with your OSGI service, I assume it would work. If you use one workspace, you can simply register your driver via the KNIME client > Preferences > KNIME > Database Driver and then use this as default for your OSGI service. So the theory.

2 posts were split to a new topic: Point to exported preferences