|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.mp3dings.export.DatabaseConnection
public class DatabaseConnection
Manages and establishes a connection to a JDBC database.
| Field Summary | |
|---|---|
static String |
P_CLASSPATH
The name of the property holding the file path of the jar archive with the JDBC driver. |
static String |
P_DRIVER
The name of the property holding the name of the JDBC driver class. |
static String |
P_FIELD_PREFIX
The prefix for property names that designate an mp3dings field. |
static String |
P_PASSWORD
The name of the property holding the database password. |
static String |
P_TABLE
The name of the property holding the name of the database table to interchange data with. |
static String |
P_URL
The name of the property holding the jdbc: URL of the database. |
static String |
P_USER
The name of the property holding the database user name. |
static String |
PREF_EXPORT
The preferences key at which the database export configuration is saved. |
static String |
PREF_IMPORT
The preferences key at which the database import configuration is saved. |
| Constructor Summary | |
|---|---|
DatabaseConnection(Properties config,
ClassLoaderProvider clp)
Establishes a new DatabaseConnection using the specified configuration. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the Database connection. |
static Properties |
editConfig(Component parent,
Properties config,
Field[] availableFields,
ClassLoaderProvider clp,
boolean allowViews)
Displays a wizard to interactively create or modify a JDBC configuration that can be used to establish a database connection. |
protected Connection |
getConnection()
Gets the jdbc connection established at instantiation. |
boolean |
isAlive()
Returns whether the database connection established at instantiation is still alive. |
static Properties |
loadConfig(String prefkey)
Tries to load a previously saved JDBC configuration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String P_DRIVER
public static final String P_CLASSPATH
public static final String P_USER
public static final String P_PASSWORD
public static final String P_URL
public static final String P_TABLE
public static final String P_FIELD_PREFIX
public static final String PREF_EXPORT
public static final String PREF_IMPORT
| Constructor Detail |
|---|
public DatabaseConnection(Properties config,
ClassLoaderProvider clp)
throws ExportException,
SQLException
editConfig method.
config - the jdbc configurationclp - a classloader provider that manages the dynamic class path
for loading the JDBC driver, may be null
ExportException - if a required property is missing in
config, or if the JDBC driver cannot be loaded
SQLException - if an SQL/JDBC error occurs| Method Detail |
|---|
public static Properties loadConfig(String prefkey)
throws IOException
prefkey - the preferences key at which the configuration was
stored, usually this will be PREF_EXPORT or PREF_IMPORT
null
if no such configuration exists
IOException - if the JDBC configuration cannot be read from
the properties file whose location was stored in the preferences
public static Properties editConfig(Component parent,
Properties config,
Field[] availableFields,
ClassLoaderProvider clp,
boolean allowViews)
throws SQLException
parent - the GUI component to use as a dialog ownerconfig - the previous configuration if any, may be nullavailableFields - the fields that are available in the mp3dings table
that will exchange data with the databaseclp - a classloader provider that manages the dynamic class path
for loading the JDBC driver, may be nullallowViews - whether to allow data exchange with views as well as
database tables. This can be true for an import configuration,
but should usually be false for an export configuration.
SQLExceptionMp3dingsTableModel.getFields()protected Connection getConnection()
public boolean isAlive()
Connection.isClosed()
public void close()
throws SQLException
SQLException
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||