public class DatabaseProvider
extends java.lang.Object
implements javax.naming.Referenceable, javax.sql.DataSource
 This class is also a DataSource and is therefore capable of creating a
 java.sql.Connection to the database as well.
 
 If the connection details are required to separately connect to the
 database (e.g. via java.sql.DriverManager), then there are two
 methods that provide the information required:
 
getConnectionURL() to get the jdbc urlgetJDBCProperties() to get the info properties that
 accompany the URL (includes user/password when required).getDriverClassName() might also be
 required.| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | ALL_SCHEMAS_REFTYPEDeprecated. 
 with no replacement. | 
| static java.lang.String | CUSTOM_URL_CLASS_REFTYPEThe URL for the database connection. | 
| static java.lang.String | DEPLOY_PASSWORD_CLASS_REFTYPEDeprecated. 
 with no replacement. | 
| static java.lang.String | DRIVER_CLASS_REFTYPEThe JDBC driver class. | 
| static java.lang.String | DSN_CLASS_REFTYPEThe source name of the database. | 
| static java.lang.String | HOSTNAME_CLASS_REFTYPEThe hostname of the database machine. | 
| static java.lang.String | INSTANCE_CLASS_REFTYPEDeprecated. 
 - moved to
  SQLServerConnectionCreator.INSTANCE_CLASS_REFTYPE. Database
 specific keys belong on the appropriate ConnectionCreator subclasses. | 
| static java.lang.String | PARAMETERS_CLASS_REFTYPEExtra parameters for the JDBC driver. | 
| static java.lang.String | PASSWORD_CLASS_REFTYPEThe database password. | 
| static java.lang.String | PORT_CLASS_REFTYPEThe network port the database is running on. | 
| static java.lang.String | ROLE_CLASS_REFTYPEThe database roles to associated with the connection session. | 
| static java.lang.String | SAVE_PASSWORD_CLASS_REFTYPEWhether to persist the password with the connection details. | 
| static java.lang.String | SERVICENAME_CLASS_REFTYPEThe service name of the database (Oracle). | 
| static java.lang.String | SID_CLASS_REFTYPEThe SID name of the database (Oracle). | 
| static java.lang.String | SUBTYPE_CLASS_REFTYPEThe subtype of the database connection. | 
| static java.lang.String | USERNAME_CLASS_REFTYPEThe database username. | 
| Constructor and Description | 
|---|
| DatabaseProvider()Creates an empty DatabaseProvider. | 
| DatabaseProvider(java.util.Properties props)Creates a new DatabaseProvider using the given properties. | 
| DatabaseProvider(java.lang.String name,
                java.util.Properties props)Creates a new DatabaseProvider using the given properties and with the
 given name. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | disconnect()Notifies this provider that the connection(s) associated with it have been
 closed. | 
| boolean | equals(java.lang.Object obj) | 
| javax.naming.directory.Attributes | getAttributes()Deprecated. 
 use  getProperties()and convert if required. | 
| java.sql.Connection | getConnection() | 
| java.sql.Connection | getConnection(java.lang.String username,
             java.lang.String password) | 
| java.lang.String | getConnectionURL()Returns the URL for the connection. | 
| static ConnectionCreator | getCreator(DatabaseProvider dp)Gets a ConnectionCreator for the given DatabaseProvider, or throws
 a SQLException if the given provider doesn't have a subtype for which
 a ConnectionCreator is registered. | 
| char[] | getCredential(java.lang.String name)Gets the given credential property from this provider. | 
| java.lang.String | getDriverClassName()Gets the driver class for the connection. | 
| java.util.Properties | getJDBCProperties()Gets the full set of properties needed to create the connection. | 
| int | getLoginTimeout() | 
| java.io.PrintWriter | getLogWriter() | 
| java.lang.String | getName()Gets the connection name that these connection details were constructed
 with. | 
| java.util.logging.Logger | getParentLogger() | 
| java.util.Properties | getProperties()Returns a copy of the underlying properties (including credentials)
 for this provider. | 
| java.lang.String | getProperty(java.lang.String name)Returns the value for the specified property on this provider. | 
| javax.naming.Reference | getReference() | 
| int | hashCode() | 
| boolean | isWrapperFor(java.lang.Class<?> iface) | 
| static void | registerConnectionCreator(java.lang.String subtype,
                         ConnectionCreator creator)Registers a ConnectionCreator implementation for a new connection
 subtype. | 
| static void | registerLazyConnectionCreator(java.lang.String subtype,
                             java.util.concurrent.Callable<ConnectionCreator> creator)Registers a ConnectionCreator implementation for a new connection
 subtype. | 
| static void | setClassLoaderFactory(DatabaseProviderClassLoaderFactory factory)Sets the factory that is repsonsible for providing a ClassLoader for
 a given JDBC driver class. | 
| void | setCredential(java.lang.String name,
             char[] value)Sets the given credential property on this provider. | 
| void | setLoginTimeout(int seconds) | 
| void | setLogWriter(java.io.PrintWriter out) | 
| void | setProperty(java.lang.String name,
           java.lang.String value)Sets the given property on this provider. | 
| void | setReferenceWorker(oracle.jdevimpl.db.adapter.ReferenceWorker worker)Internal use only - sets the reference worker that this provider should
 use when creating a Referenceable. | 
| boolean | shouldPromptForCredentials()Tests whether the Properties of this DatabaseProvider are sufficient to
 create a Connection, or whether the user should be prompted for the
 username and password. | 
| <T> T | unwrap(java.lang.Class<T> iface) | 
public static final java.lang.String SUBTYPE_CLASS_REFTYPE
public static final java.lang.String CUSTOM_URL_CLASS_REFTYPE
public static final java.lang.String DRIVER_CLASS_REFTYPE
public static final java.lang.String USERNAME_CLASS_REFTYPE
public static final java.lang.String PASSWORD_CLASS_REFTYPE
public static final java.lang.String ROLE_CLASS_REFTYPE
public static final java.lang.String HOSTNAME_CLASS_REFTYPE
public static final java.lang.String PORT_CLASS_REFTYPE
public static final java.lang.String SID_CLASS_REFTYPE
service name.public static final java.lang.String DSN_CLASS_REFTYPE
@Deprecated public static final java.lang.String INSTANCE_CLASS_REFTYPE
SQLServerConnectionCreator.INSTANCE_CLASS_REFTYPE. Database
 specific keys belong on the appropriate ConnectionCreator subclasses.public static final java.lang.String PARAMETERS_CLASS_REFTYPE
JDBCParametersParser, 
Constant Field Valuespublic static final java.lang.String SERVICENAME_CLASS_REFTYPE
SID.public static final java.lang.String SAVE_PASSWORD_CLASS_REFTYPE
@Deprecated public static final java.lang.String DEPLOY_PASSWORD_CLASS_REFTYPE
@Deprecated public static final java.lang.String ALL_SCHEMAS_REFTYPE
public DatabaseProvider()
public DatabaseProvider(java.util.Properties props)
props - the properties to initialise this provider withpublic DatabaseProvider(java.lang.String name,
                        java.util.Properties props)
name - the connection nameprops - the properties that define the connectionpublic void setReferenceWorker(oracle.jdevimpl.db.adapter.ReferenceWorker worker)
worker - the reference worker this provider should usepublic java.lang.String getName()
public javax.naming.Reference getReference()
getReference in interface javax.naming.Referenceablepublic java.sql.Connection getConnection()
                                  throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter out)
                  throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic int getLoginTimeout()
                    throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLoginTimeout(int seconds)
                     throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
             throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
getParentLogger in interface javax.sql.CommonDataSourcepublic java.lang.String getConnectionURL()
                                  throws java.sql.SQLException
java.sql.SQLException - if a valid connection URL cannot be created from
 the properties in this referenceable.public java.util.Properties getJDBCProperties()
                                       throws java.sql.SQLException
java.sql.SQLException - if a valid set of properties cannot be created
 the properties in this referenceable.public java.lang.String getDriverClassName()
                                    throws java.sql.SQLException
java.sql.SQLException - if the driver class name cannot be determined from
 the properties in this referenceable.public boolean shouldPromptForCredentials()
 This will return false if the SUBTYPE_CLASS_REFTYPE property
 is missing or invalid.
public java.lang.String getProperty(java.lang.String name)
name - the property namepublic java.util.Properties getProperties()
public void setProperty(java.lang.String name,
                        java.lang.String value)
name - the property namevalue - the property valuepublic char[] getCredential(java.lang.String name)
name - the name of the credential propertypublic void setCredential(java.lang.String name,
                          char[] value)
name - the property namevalue - the credential valuepublic void disconnect()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object@Deprecated public javax.naming.directory.Attributes getAttributes()
getProperties() and convert if required.public static void setClassLoaderFactory(DatabaseProviderClassLoaderFactory factory)
factory - the class loader factorypublic static ConnectionCreator getCreator(DatabaseProvider dp) throws java.sql.SQLException
dp - the provider instance to lookup a creator forjava.sql.SQLException - if the provider's subtype doesn't have a
 registered created.public static void registerConnectionCreator(java.lang.String subtype,
                                             ConnectionCreator creator)
registerLazyConnectionCreator(java.lang.String, java.util.concurrent.Callable<oracle.jdeveloper.db.adapter.ConnectionCreator>) to delay
 class/extension initialisation.subtype - the subtype for the connectioncreator - the creator responsible for creating connections of the
 given subtype.public static void registerLazyConnectionCreator(java.lang.String subtype,
                                                 java.util.concurrent.Callable<ConnectionCreator> creator)
subtype - the subtype for the connectioncreator - the creator responsible for creating connections of the
 given subtype.