public class MySQLConnectionCreator extends AbstractConnectionCreator implements SSHConnectionCreator
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MYSQL_DRIVER_CLASS |
static java.lang.String |
SUBTYPE_MYSQL |
| Constructor and Description |
|---|
MySQLConnectionCreator() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
allowNullPassword()
Returns false by default if
password is an allowed
property. |
SSHTunnelConfiguration |
getConfiguration(DatabaseProvider pro)
Gets an SSHTunnelConfiguration (with the url, and the host and port
information separate) for the connection details in the given
DatabaseProvider.
|
java.sql.Connection |
getConnection(java.util.Properties props)
Default implementation uses the standard properties for username and
password, and the URL and driver class name to create a connection.
|
java.lang.String |
getConnectionURL(java.util.Properties props)
The default implementation on this abstract class return the
DatabaseProvider.DRIVER_CLASS_REFTYPE property.
|
java.lang.String |
getDriverClassName(java.util.Properties props)
The default implementation on this class returns the
DatabaseProvider.CUSTOM_URL_CLASS_REFTYPE property.
|
java.util.Collection<java.lang.String> |
listAllowedProperties()
Gets a list of the properties that are relevant to this creator.
|
java.util.Collection<java.lang.String> |
listRequiredProperties()
Gets a list of the properties that are required for this creator to be
able to create a connection.
|
convertToJDBCParameterInfos, getBundle, getDriver, getInvalidURLMessage, getJDBCProperties, getLogger, getPropertyOrThrow, hasLength, isPassword, listJDBCParameterInfos, loadDriver, setCustomProperties, shouldEncrypt, shouldPromptForPassword, shouldSave, throwMissingPropertyExceptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetJDBCProperties, isPassword, listJDBCParameterInfos, shouldEncrypt, shouldPromptForPassword, shouldSavepublic static final java.lang.String MYSQL_DRIVER_CLASS
public static final java.lang.String SUBTYPE_MYSQL
protected boolean allowNullPassword()
AbstractConnectionCreatorpassword is an allowed
property.allowNullPassword in class AbstractConnectionCreatorAbstractConnectionCreator.listAllowedProperties()public java.sql.Connection getConnection(java.util.Properties props)
throws java.sql.SQLException
AbstractConnectionCreatorWhen loading the JDBC driver class a ClassLoader for the class is searched for in the following order (if any ClassLoader loads the Class it is used, otherwise the next in the list is tested):
Thread.currentThread().getContextClassLoader()ClassLoader.getSystemClassLoader()getConnection in interface ConnectionCreatorgetConnection in class AbstractConnectionCreatorprops - the properties from the underlying DatabaseProvider
connection definitionjava.sql.SQLException - if the connection cannot be created because the data
is wrong or the database is down.AbstractConnectionCreator.getConnectionURL(Properties),
AbstractConnectionCreator.getDriverClassName(Properties)public java.lang.String getDriverClassName(java.util.Properties props)
throws java.sql.SQLException
AbstractConnectionCreatorgetDriverClassName in interface ConnectionCreatorgetDriverClassName in class AbstractConnectionCreatorjava.sql.SQLExceptionpublic java.lang.String getConnectionURL(java.util.Properties props)
throws java.sql.SQLException
AbstractConnectionCreatorgetConnectionURL in interface ConnectionCreatorgetConnectionURL in class AbstractConnectionCreatorprops - the properties from the underlying DatabaseProvider
connection definitionjava.sql.SQLException - if a valid connection URL cannot be created with
the given props.public java.util.Collection<java.lang.String> listAllowedProperties()
ConnectionCreatorlistAllowedProperties in interface ConnectionCreatorlistAllowedProperties in class AbstractConnectionCreatorConnectionCreator.listRequiredProperties()public java.util.Collection<java.lang.String> listRequiredProperties()
ConnectionCreator
DatabaseProvider.SUBTYPE_CLASS_REFTYPE is always implicitly
required, it does not need to be included in this list.
listRequiredProperties in interface ConnectionCreatorlistRequiredProperties in class AbstractConnectionCreatorConnectionCreator.listAllowedProperties()public SSHTunnelConfiguration getConfiguration(DatabaseProvider pro) throws java.sql.SQLException
SSHConnectionCreatorgetConfiguration in interface SSHConnectionCreatorpro - the connection detailsjava.sql.SQLException - if the connection details are not valid and the
tunnel configuration cannot be determined.