Package org.eclipse.persistence.sessions
Class DefaultConnector
java.lang.Object
org.eclipse.persistence.sessions.DefaultConnector
- All Implemented Interfaces:
Serializable
,Cloneable
,Connector
- Direct Known Subclasses:
DirectConnector
Purpose:Use this Connector to build a java.sql.Connection in the "standard" fashion, via the DriverManager.
- See Also:
- Author:
- Big Country
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPUBLIC: Construct a Connector with default settings The database URL will still need to be set.DefaultConnector
(String driverClassName, String driverURLHeader, String databaseURL) PUBLIC: Construct a Connector with the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
INTERNAL: Discard the cached driver class and driver.clone()
INTERNAL: Clone the connector.connect
(Properties properties, Session session) INTERNAL: Connect with the specified properties and session.protected Connection
directConnect
(Properties properties) INTERNAL: Connect directly - without using DriverManager.PUBLIC: Provide the details of my connection information.PUBLIC: Return the JDBC connection string.PUBLIC: The database URL is the JDBC URL for the database server.PUBLIC: The driver class is the name of the Java class for the JDBC driver being used (e.g.PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g.protected void
initialize
(String driverClassName, String driverURLHeader, String databaseURL) INTERNAL: Initialize the connector with the specified settings.protected void
INTERNAL: Instantiate the Driver.protected void
loadDriverClass
(Session session) INTERNAL: Ensure that the driver has been loaded and registered with the DriverManager.void
setDatabaseURL
(String databaseURL) PUBLIC: The database URL is the JDBC URL for the database server.void
setDriverClassName
(String driverClassName) PUBLIC: The driver class is the name of the Java class for the JDBC driver being used (e.g.void
setDriverURLHeader
(String driverURLHeader) PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g.boolean
shouldUseDriverManager
(Properties properties, Session session) INTERNAL: Indicates whether DriverManager should be used.toString()
PUBLIC: Print connection string.void
toString
(PrintWriter writer) INTERNAL: Print something useful on the log.
-
Field Details
-
driverClassName
-
driverURLHeader
-
databaseURL
-
driverClass
cache up the driver class to speed up reconnects -
driver
cache up the instantiated Driver to speed up reconnects
-
-
Constructor Details
-
DefaultConnector
public DefaultConnector()PUBLIC: Construct a Connector with default settings The database URL will still need to be set. -
DefaultConnector
PUBLIC: Construct a Connector with the specified settings.
-
-
Method Details
-
clone
INTERNAL: Clone the connector. -
connect
INTERNAL: Connect with the specified properties and session. Return the Connection.- Specified by:
connect
in interfaceConnector
- Returns:
- java.sql.Connection
- Throws:
DatabaseException
-
shouldUseDriverManager
INTERNAL: Indicates whether DriverManager should be used.- Returns:
- boolean
-
directConnect
INTERNAL: Connect directly - without using DriverManager. Return the Connection.- Returns:
- java.sql.Connection
- Throws:
DatabaseException
-
getConnectionString
PUBLIC: Return the JDBC connection string. This is a combination of the driver-specific URL header and the database URL. -
getConnectionDetails
PUBLIC: Provide the details of my connection information. This is primarily for JMX runtime services.- Specified by:
getConnectionDetails
in interfaceConnector
- Returns:
- java.lang.String
-
getDatabaseURL
PUBLIC: The database URL is the JDBC URL for the database server. The driver header is not be included in this URL (e.g. "dbase files"; not "jdbc:odbc:dbase files"). -
getDriverClassName
PUBLIC: The driver class is the name of the Java class for the JDBC driver being used (e.g. "sun.jdbc.odbc.JdbcOdbcDriver"). -
getDriverURLHeader
PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g. "jdbc:odbc:"). This is required to connect to the database. -
initialize
INTERNAL: Initialize the connector with the specified settings. -
loadDriverClass
INTERNAL: Ensure that the driver has been loaded and registered with the DriverManager. Just loading the class should cause the static initialization code to do the necessary registration. Return the loaded driver Class.- Throws:
DatabaseException
-
setDatabaseURL
PUBLIC: The database URL is the JDBC URL for the database server. The driver header is not be included in this URL (e.g. "dbase files"; not "jdbc:odbc:dbase files"). -
setDriverClassName
PUBLIC: The driver class is the name of the Java class for the JDBC driver being used (e.g. "sun.jdbc.odbc.JdbcOdbcDriver"). -
setDriverURLHeader
PUBLIC: The driver URL header is the string predetermined by the JDBC driver to be part of the URL connection string, (e.g. "jdbc:odbc:"). This is required to connect to the database. -
toString
PUBLIC: Print connection string. -
toString
INTERNAL: Print something useful on the log. -
instantiateDriver
INTERNAL: Instantiate the Driver.- Throws:
DatabaseException
-
clearDriverClassAndDriver
public void clearDriverClassAndDriver()INTERNAL: Discard the cached driver class and driver.
-