Package com.iizix.jdbc
Class JDBCHelper
java.lang.Object
com.iizix.jdbc.JDBCHelper
Derby instance for iiziGo and iiziServer.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- static intDisposes of created instance and stops the Derby network server if started.- static IDBConnectionPoolConstructs the Derby database connection pool from a directory that can contain a "dbconf.properties" file.- static IDBConnectionPool- from- (String name, PropCnr cnr, Properties driverProps) Creates a database connection pool from values stored in a property container.- static IDBConnectionPoolConstructs the database connection pool from a directory that should contain a "dbconf.properties" file.- static URL[]- getClassLoaderURLs- (File dir, String classPath) Parses the classPath into URL's with the specified directory as the relative directory.- static File- initialize- (IFileURLResolver resolver) Initializes the file resolver and looks up the- [resources/]jdbc-driversdirectory.- static String- setUsePrivateDirectory- (boolean doCopy) Sets the JDBC drivers directory to be the user's private directory "~/.iizi/jdbc-drivers".
- Constructor Details- JDBCHelperpublic JDBCHelper()
 
- Method Details- setUsePrivateDirectorySets the JDBC drivers directory to be the user's private directory "~/.iizi/jdbc-drivers".- Parameters:
- doCopy- Flag to perform copy of the normal JDBC drivers directory to the user's private directory "~/.iizi/jdbc-drivers".
- Returns:
- Error message for failure, null for success.
 
- initializeInitializes the file resolver and looks up the- [resources/]jdbc-driversdirectory.- Parameters:
- resolver- The URL to File resolver.
- Returns:
- The canonical directory for the jdbc-drivers.
- Throws:
- IOException- If the the- [resources/]jdbc-driversdirectory is not found, or if the user's private directory for JDBC drivers "~/.iizi/jdbc-drivers" is not found or copy/update or drivers and files failed.
 
- getClassLoaderURLsParses the classPath into URL's with the specified directory as the relative directory.- Parameters:
- dir- The directory that is used for relative paths in the classpath for directories This directory is normally the one containing the 'dbconf*.properties' file to process the 'classpath' entry. If- diris- nullthe classpath must either contain absolute paths or in case of no classpath, an empty URL array is returned.
- classPath- The classpath with a comma as separator (not the system separator ";" for Windows or ":" for other systems). To specify a comma, enter it twice. The path must consist of either directories or (Jar) files.
- Returns:
- The URL's is never an empty array. If classPath is null or empty string, the URL is set to the dirURL.
- Throws:
- IOException- If the classPath references non-existent or erroneous paths, or the path part is a file that is does not have the '.jar' or '.zip' file extension.
 
- fromConstructs the database connection pool from a directory that should contain a "dbconf.properties" file.- Parameters:
- name- The name of the database connection pool.
- dir- The directory where the "dbconf.properties" should be present.
- Throws:
- IOException- For I/O errors.
- SQLException- For errors in creating the database pool.
 
- frompublic static IDBConnectionPool from- (String name, DerbyImpl derbyImpl) throws IOException, SQLException Constructs the Derby database connection pool from a directory that can contain a "dbconf.properties" file.- Parameters:
- name- The name of the database connection pool.
- derbyImpl- The Derby implementation.
- Returns:
- The database connection pool.
- Throws:
- IOException- For I/O errors.
- SQLException- For errors in creating the database pool.
 
- frompublic static IDBConnectionPool from- (String name, PropCnr cnr, Properties driverProps) throws SQLException, IOException Creates a database connection pool from values stored in a property container.- Parameters:
- name- The name of the database connection pool.
- cnr- The property container.
- driverProps- The driver properties, null for none.
- Returns:
- The database connection pool.
- Throws:
- SQLException- For errors in creating the database pool
- IOException- For I/O errors.
 
- disposeAllpublic static int disposeAll()Disposes of created instance and stops the Derby network server if started.- Returns:
- count of disposed instances, zero for none.