How to use JDBC driver added in Preferences?

I have added the oracle driver ojdbc6.jar in Preferences->KNIME->Databases. I did this in the sdk itself and then when testing my node in the KNIME perspective I had to add it again.

However I get an exception that no suitable driver is found for my connection string and this means that the oracle driver is not loaded at all. I verfied this with

Class.forName("oracle.jdbc.driver.OracleDriver");

which throws a ClassNotFoundException.

How can I load and use this driver in my node automatically?

 

 

You need to register the driver in the KNIME instance that you start from within the SDK.

Yes I did that. That is what I mean with:

I did this in the sdk itself and then when testing my node in the KNIME perspective I had to add it again.

How am i supposed to open a connection? Using DriverManager?

Below code shows that Oracle driver is not available in DriverManager:

Enumeration<Driver> drivers = DriverManager.getDrivers();
while(drivers.hasMoreElements()) {
    Driver driver = drivers.nextElement();
    System.out.println(driver.toString());
}

EDIT:

The (undocumented) solution is:

DatabaseDriverLoader.registerDriver("oracle.jdbc.OracleDriver");

 

 

Ary our refering to the KNIME perspective in the KNIME SDK? You need to start an new KNIME application from the SDK, not just switch the perspective in the SDK.

KNIME registers all drivers found in all Jar files registered in the preferences. So you should not need to register it manually.

I start a new istance through the Run menu in the SDK via the run configuration. Is that correct?