org.knime.core.node.port.database
Class DatabaseDriverLoader

java.lang.Object
  extended by org.knime.core.node.port.database.DatabaseDriverLoader

public final class DatabaseDriverLoader
extends Object

Utility class to load additional drivers from jar and zip to the DriverManager.

Author:
Thomas Gabriel, University of Konstanz

Field Summary
static String[] EXTENSIONS
          Allowed file extensions, jar and zip only.
(package private) static String JDBC_ODBC_DRIVER
          Name of the standard JDBC-ODBC database driver, sun.jdbc.odbc.JdbcOdbcDriver object.
 
Method Summary
static File getDriverFileForDriverClass(String driverClass)
          Returns the absolute path for the driver class name from which it has been loaded.
static Set<String> getLoadedDriver()
           
static String getURLForDriver(String driver)
          Returns a URL protocol for a given Driver extended by an default host, port, database name String.
static void loadDriver(File file)
          Loads Driver from the given file.
(package private) static Driver registerDriver(String driver)
          Registers given Driver at the DriverManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JDBC_ODBC_DRIVER

static final String JDBC_ODBC_DRIVER
Name of the standard JDBC-ODBC database driver, sun.jdbc.odbc.JdbcOdbcDriver object. Loaded per default.

See Also:
Constant Field Values

EXTENSIONS

public static final String[] EXTENSIONS
Allowed file extensions, jar and zip only.

Method Detail

registerDriver

static Driver registerDriver(String driver)
                      throws InvalidSettingsException
Registers given Driver at the DriverManager.

Parameters:
driver - to register
Returns:
SQL Driver
Throws:
InvalidSettingsException - if the database drivers could not registered

loadDriver

public static final void loadDriver(File file)
                             throws IOException
Loads Driver from the given file.

Parameters:
file - Load driver from.
Throws:
IOException - IOException

getLoadedDriver

public static Set<String> getLoadedDriver()
Returns:
A set if loaded driver names.

getURLForDriver

public static final String getURLForDriver(String driver)
Returns a URL protocol for a given Driver extended by an default host, port, database name String. If no protocol URL has been defined the default String staring with protocol is return.

Parameters:
driver - the driver to match URL protocol
Returns:
an String containing protocol, port, host, and database name place holder

getDriverFileForDriverClass

public static final File getDriverFileForDriverClass(String driverClass)
Returns the absolute path for the driver class name from which it has been loaded.

Parameters:
driverClass - driver class name
Returns:
driver file location


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.