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

java.lang.Object
  extended by org.knime.core.node.port.database.DatabaseConnectionSettings
Direct Known Subclasses:
DatabaseQueryConnectionSettings

public class DatabaseConnectionSettings
extends Object

Author:
Thomas Gabriel, University of Konstanz

Field Summary
static String CFG_STATEMENT
          Config for SQL statement.
static StringHistory DATABASE_URLS
          Keeps the history of all database URLs.
static StringHistory DRIVER_ORDER
          Keeps the history of all loaded driver and its order.
static Integer FETCH_SIZE
          DriverManager fetch size to chunk specified number of rows.
 
Constructor Summary
DatabaseConnectionSettings()
          Create a default settings connection object.
DatabaseConnectionSettings(DatabaseConnectionSettings conn)
          Creates a new DBConnection based on the given connection object.
 
Method Summary
 Connection createConnection()
          Create a database connection based on this settings.
 ModelContentRO createConnectionModel()
          Create connection model with all settings used to create a database connection.
 void execute(String statement)
          Execute statement on current database connection.
 String getDBName()
           
 String getDriver()
           
 boolean loadValidatedConnection(ConfigRO settings)
          Load validated settings.
 void saveConnection(ConfigWO settings)
          Save settings.
 void validateConnection(ConfigRO settings)
          Validate settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CFG_STATEMENT

public static final String CFG_STATEMENT
Config for SQL statement.

See Also:
Constant Field Values

DRIVER_ORDER

public static final StringHistory DRIVER_ORDER
Keeps the history of all loaded driver and its order.


DATABASE_URLS

public static final StringHistory DATABASE_URLS
Keeps the history of all database URLs.


FETCH_SIZE

public static final Integer FETCH_SIZE
DriverManager fetch size to chunk specified number of rows.

Constructor Detail

DatabaseConnectionSettings

public DatabaseConnectionSettings()
Create a default settings connection object.


DatabaseConnectionSettings

public DatabaseConnectionSettings(DatabaseConnectionSettings conn)
Creates a new DBConnection based on the given connection object.

Parameters:
conn - connection used to copy settings from
Method Detail

createConnection

public Connection createConnection()
                            throws InvalidSettingsException,
                                   SQLException,
                                   BadPaddingException,
                                   IllegalBlockSizeException,
                                   InvalidKeyException,
                                   IOException
Create a database connection based on this settings.

Returns:
a new database connection object.
Throws:
SQLException - SQLException
InvalidSettingsException - InvalidSettingsException
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
IOException - IOException

saveConnection

public void saveConnection(ConfigWO settings)
Save settings.

Parameters:
settings - connection settings

validateConnection

public void validateConnection(ConfigRO settings)
                        throws InvalidSettingsException
Validate settings.

Parameters:
settings - to validate
Throws:
InvalidSettingsException - if the settings are not valid

loadValidatedConnection

public boolean loadValidatedConnection(ConfigRO settings)
                                throws InvalidSettingsException
Load validated settings.

Parameters:
settings - to load
Returns:
true, if settings have changed
Throws:
InvalidSettingsException - if settings are invalid

execute

public void execute(String statement)
             throws InvalidKeyException,
                    BadPaddingException,
                    IllegalBlockSizeException,
                    InvalidSettingsException,
                    SQLException,
                    IOException
Execute statement on current database connection.

Parameters:
statement - to be executed
Throws:
SQLException - SQLException
InvalidSettingsException - InvalidSettingsException
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
IOException - IOException

createConnectionModel

public ModelContentRO createConnectionModel()
Create connection model with all settings used to create a database connection.

Returns:
database connection model

getDriver

public final String getDriver()
Returns:
database driver used to open the connection

getDBName

public final String getDBName()
Returns:
database name used to access the db URL


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.