public class DBUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATABASE_DIRECTORY
The default database directory: "db".
|
Constructor and Description |
---|
DBUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areTablesCreated(Connection conn,
String schema,
String table)
Checks if the tables already are created.
|
static void |
createTables(Connection conn)
Creates the tables.
|
static void |
createTables(Connection conn,
InputStream in)
Creates the tables.
|
static void |
createTables(Connection conn,
InputStream in,
String originalSchema,
String newSchema)
Creates the tables with a change of the schema from "original" to "new".
|
static IDBConnectionPool |
getConnectionPool(IFileURLResolver fileURLResolver)
Creates the connection pool.
|
static int |
getJDBCFlavor()
Gets the flavor of the JDBC used in the internal server database.
|
static Connection |
getPooledConnection()
Gets a pooled connection for user processing to the internal server database.
|
static int |
getServerDatabaseReady()
Returns whether the Server internal database is ready for use, i.e.
|
static String |
getServerHost()
Gets the Derby network database server host name for connections.
|
static int |
getServerPort()
Gets the Derby network database server port for connections.
|
static void |
registerPoolProxy(IDBPoolProxy proxy)
Registers a database pool proxy.
|
static void |
setAutoCreate(boolean on)
Sets the database auto-create flag.
|
static void |
setDBConf(String dirName)
Processes the database configuration directive.
|
static void |
setDirectory(String dir)
Sets the database directory for the internal server.
|
static void |
setFileURLResolver(IFileURLResolver resolver)
Interface used to resolve URL's to files for the Designer.
|
static void |
setServerAutoStart(boolean on)
Sets the Derby network database server auto-start flag.
|
static void |
setServerHost(String host)
Sets the Derby network database server host name for connections.
|
static void |
setServerPort(int port)
Sets the Derby network database server port for connections.
|
public static final String DEFAULT_DATABASE_DIRECTORY
public static int getJDBCFlavor()
See the FLAVOR_* values.
public static void setDBConf(String dirName) throws IOException
dirName
- The database configuration directory.IOException
- For I/O errors.public static void setFileURLResolver(IFileURLResolver resolver)
resolver
- The resolver instance.NullPointerException
- If the resolver is null.public static void setAutoCreate(boolean on)
on
- The automatic start flag.public static void setServerAutoStart(boolean on)
on
- The automatic start flag.public static void setServerHost(String host)
host
- The host for the Client Derby driver.NullPointerException
- If the host name is null.IllegalArgumentException
- If the host is invalid.public static String getServerHost()
public static void setServerPort(int port)
port
- The port number for the Client Derby driver.IllegalArgumentException
- If the number is invalid.public static int getServerPort()
public static void setDirectory(String dir) throws FileNotFoundException, IOException
dir
- The new directory. The database name will be "iiziServer"FileNotFoundException
- If the parent directory does not exist.IOException
- For file system errors.public static void registerPoolProxy(IDBPoolProxy proxy) throws SQLException
proxy
- The proxy.SQLException
- For connection, class loader or instantiation failures.SecurityException
- If caller is not allowed.public static IDBConnectionPool getConnectionPool(IFileURLResolver fileURLResolver) throws SQLException
fileURLResolver
- File resolver from an URL.SQLException
- For connection, class loader or instantiation failures.SecurityException
- If the caller is not allowed to access the server database connection pool.public static boolean areTablesCreated(Connection conn, String schema, String table)
conn
- The connection.schema
- The schema.table
- The table.public static int getServerDatabaseReady()
public static Connection getPooledConnection() throws SQLException
SQLException
- For SQL errors.public static void createTables(Connection conn) throws SQLException
conn
- The connection.SQLException
- For SQL errors.public static void createTables(Connection conn, InputStream in) throws SQLException
conn
- The connection.in
- Input stream to a "createTables.sql" file. The input stream is closed regardless of exceptions.
The input stream is processed using UTF-8.SQLException
- For SQL errors.public static void createTables(Connection conn, InputStream in, String originalSchema, String newSchema) throws SQLException
conn
- The connection.in
- Input stream to a "createTables.sql" file. The input stream is closed regardless of exceptions.originalSchema
- The original schema name (upper case).newSchema
- The new schema name (upper case).SQLException
- For SQL errors.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.