Top Description Fields Constructors Methods
org.apache.derby.client

public Class ClientAutoloadedDriver

extends Object
implements Driver
Class Inheritance
All Implemented Interfaces
java.sql.Driver
Imports
java.sql.Connection, .Driver, .DriverManager, .DriverPropertyInfo, .SQLException, .SQLFeatureNotSupportedException, java.util.Enumeration, .Properties, .NoSuchElementException, .StringTokenizer, java.util.logging.Logger, org.apache.derby.client.am.Configuration, .SqlException, .Utils, .Version, .ClientJDBCObjectFactory, .ClientMessageId, .LogWriter, org.apache.derby.client.net.ClientJDBCObjectFactoryImpl, .NetConnection, org.apache.derby.shared.common.reference.Attribute, .SQLState, .MessageId

The client JDBC driver (type 4) for Derby.

Field Summary

Modifier and TypeField and Description
private static final int
private static SQLException
private static ClientJDBCObjectFactory
private static ClientAutoloadedDriver
private transient int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
acceptsURL(String
the URL of the database
url
)

Implements java.sql.Driver.acceptsURL.

Retrieves whether the driver thinks that it can open a connection to the given URL.
private String

Returns:

databaseName + attributes (e.g. mydb;create=true)
appendDatabaseAttributes
(String
- Short database name
database
,
Properties
- Set of properties to append as attributes
augmentedProperties
)

Append attributes to the database name except for user/password which are sent as part of the protocol, and SSL which is used locally in the client.

private void
public Connection
connect(String
the URL of the database to which to connect
url
,
Properties
a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.
properties
)

Implements java.sql.Driver.connect.

Attempts to make a database connection to the given URL.
private static ClientJDBCObjectFactory
createDefaultFactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl class

private static ClientJDBCObjectFactory
createJDBC40FactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl40 class If a ClassNotFoundException occurs then it returns an instance of ClientJDBCObjectFactoryImpl If a future version of JDBC comes then a similar method would be added say createJDBCXXFactoryImpl in which if the class is not found then it would return the lower version thus having a sort of cascading effect until it gets a valid instance

private static ClientJDBCObjectFactory
createJDBC42FactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl42 class If a ClassNotFoundException occurs then it returns an instance of the most refined ClientJDBCObjectFactoryImpl possible If a future version of JDBC comes then a similar method would be added say createJDBCXXFactoryImpl in which if the class is not found then it would return the lower version thus having a sort of cascading effect until it gets a valid instance

public static ClientJDBCObjectFactory

Returns:

the client-side object factory
getFactory
()

This method returns an Implementation of ClientJDBCObjectFactory depending on VM under use Currently it returns either ClientJDBCObjectFactoryImpl (or) ClientJDBCObjectFactoryImpl42

public int
getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Retrieves the driver's major version number.
public int
getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Gets the driver's minor version number.
public Logger
getParentLogger()

Implements java.sql.Driver.getParentLogger.

Return the parent Logger of all the Loggers used by this driver.
public DriverPropertyInfo[]
getPropertyInfo(String
the URL of the database to which to connect
url
,
Properties
a proposed list of tag/value pairs that will be sent on connect open
properties
)

Implements java.sql.Driver.getPropertyInfo.

Gets information about the possible properties for this driver.
public boolean
jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Reports whether this driver is a genuine JDBC Compliant driver.
protected static void
private static String
private static int
private static int
private static String
private static Properties
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DERBY_REMOTE_PROTOCOLback to summary
private static final int DERBY_REMOTE_PROTOCOL
exceptionsOnLoadDriver__back to summary
private static SQLException exceptionsOnLoadDriver__
factoryObjectback to summary
private static ClientJDBCObjectFactory factoryObject
registeredDriver__back to summary
private static ClientAutoloadedDriver registeredDriver__
traceFileSuffixIndex_back to summary
private transient int traceFileSuffixIndex_

Constructor Detail

ClientAutoloadedDriverback to summary
public ClientAutoloadedDriver()

Method Detail

acceptsURLback to summary
public boolean acceptsURL(String url) throws SQLException

Implements java.sql.Driver.acceptsURL.

Doc from java.sql.Driver.acceptsURL.

Retrieves whether the driver thinks that it can open a connection to the given URL. Typically drivers will return true if they understand the sub-protocol specified in the URL and false if they do not.

Parameters
url:String

the URL of the database

Returns:boolean

true if this driver understands the given URL; false otherwise

Exceptions
SQLException:
if a database access error occurs or the url is null
appendDatabaseAttributesback to summary
private String appendDatabaseAttributes(String database, Properties augmentedProperties)

Append attributes to the database name except for user/password which are sent as part of the protocol, and SSL which is used locally in the client. Other attributes will be sent to the server with the database name Assumes augmentedProperties is not null

Parameters
database:String

- Short database name

augmentedProperties:Properties

- Set of properties to append as attributes

Returns:String

databaseName + attributes (e.g. mydb;create=true)

checkURLNotNullback to summary
private void checkURLNotNull(String url) throws SQLException
connectback to summary
public Connection connect(String url, Properties properties) throws SQLException

Implements java.sql.Driver.connect.

Doc from java.sql.Driver.connect.

Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn.

The driver should throw an SQLException if it is the right driver to connect to the given URL but has trouble connecting to the database.

The Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties object.

Note

If a property is specified as part of the url and is also specified in the Properties object, it is implementation-defined as to which value will take precedence. For maximum portability, an application should only specify a property once.

Parameters
url:String

the URL of the database to which to connect

properties:Properties

a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.

Returns:Connection

a Connection object that represents a connection to the URL

Exceptions
SQLException:
if a database access error occurs or the url is null
createDefaultFactoryImplback to summary
private static ClientJDBCObjectFactory createDefaultFactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl class

createJDBC40FactoryImplback to summary
private static ClientJDBCObjectFactory createJDBC40FactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl40 class If a ClassNotFoundException occurs then it returns an instance of ClientJDBCObjectFactoryImpl If a future version of JDBC comes then a similar method would be added say createJDBCXXFactoryImpl in which if the class is not found then it would return the lower version thus having a sort of cascading effect until it gets a valid instance

createJDBC42FactoryImplback to summary
private static ClientJDBCObjectFactory createJDBC42FactoryImpl()

Returns an instance of the ClientJDBCObjectFactoryImpl42 class If a ClassNotFoundException occurs then it returns an instance of the most refined ClientJDBCObjectFactoryImpl possible If a future version of JDBC comes then a similar method would be added say createJDBCXXFactoryImpl in which if the class is not found then it would return the lower version thus having a sort of cascading effect until it gets a valid instance

getFactoryback to summary
public static ClientJDBCObjectFactory getFactory()

This method returns an Implementation of ClientJDBCObjectFactory depending on VM under use Currently it returns either ClientJDBCObjectFactoryImpl (or) ClientJDBCObjectFactoryImpl42

Returns:ClientJDBCObjectFactory

the client-side object factory

getMajorVersionback to summary
public int getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Doc from java.sql.Driver.getMajorVersion.

Retrieves the driver's major version number. Initially this should be 1.

Returns:int

this driver's major version number

getMinorVersionback to summary
public int getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Doc from java.sql.Driver.getMinorVersion.

Gets the driver's minor version number. Initially this should be 0.

Returns:int

this driver's minor version number

getParentLoggerback to summary
public Logger getParentLogger() throws SQLFeatureNotSupportedException

Implements java.sql.Driver.getParentLogger.

Doc from java.sql.Driver.getParentLogger.

Return the parent Logger of all the Loggers used by this driver. This should be the Logger farthest from the root Logger that is still an ancestor of all of the Loggers used by this driver. Configuring this Logger will affect all of the log messages generated by the driver. In the worst case, this may be the root Logger.

Returns:Logger

the parent Logger for this driver

Exceptions
SQLFeatureNotSupportedException:
if the driver does not use java.util.logging.
getPropertyInfoback to summary
public DriverPropertyInfo[] getPropertyInfo(String url, Properties properties) throws SQLException

Implements java.sql.Driver.getPropertyInfo.

Doc from java.sql.Driver.getPropertyInfo.

Gets information about the possible properties for this driver.

The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate though several calls to the getPropertyInfo method.

Parameters
url:String

the URL of the database to which to connect

properties:Properties

a proposed list of tag/value pairs that will be sent on connect open

Returns:DriverPropertyInfo[]

an array of DriverPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.

Exceptions
SQLException:
if a database access error occurs
jdbcCompliantback to summary
public boolean jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Doc from java.sql.Driver.jdbcCompliant.

Reports whether this driver is a genuine JDBC Compliant driver. A driver may only report true here if it passes the JDBC compliance tests; otherwise it is required to return false.

JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases.

This method is not intended to encourage the development of non-JDBC compliant drivers, but is a recognition of the fact that some vendors are interested in using the JDBC API and framework for lightweight databases that do not support full database functionality, or for special databases such as document information retrieval where a SQL implementation may not be feasible.

Returns:boolean

true if this driver is JDBC Compliant; false otherwise

registerMeback to summary
protected static void registerMe(ClientAutoloadedDriver me)
tokenizeDatabaseback to summary
private static String tokenizeDatabase(StringTokenizer urlTokenizer, String url) throws SqlException
tokenizeOptionalPortNumberback to summary
private static int tokenizeOptionalPortNumber(StringTokenizer urlTokenizer, String url) throws SqlException
tokenizeProtocolback to summary
private static int tokenizeProtocol(String url, StringTokenizer urlTokenizer) throws SqlException
tokenizeServerNameback to summary
private static String tokenizeServerName(StringTokenizer urlTokenizer, String url) throws SqlException
tokenizeURLPropertiesback to summary
private static Properties tokenizeURLProperties(String url, Properties properties) throws SqlException