org.apache.derby.jdbc
Class ClientBaseDataSourceRoot

java.lang.Object
  extended by org.apache.derby.jdbc.ClientBaseDataSourceRoot
All Implemented Interfaces:
java.io.Serializable, java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource, ClientDataSourceInterface
Direct Known Subclasses:
BasicClientDataSource40, ClientBaseDataSource

public abstract class ClientBaseDataSourceRoot
extends java.lang.Object
implements java.io.Serializable, ClientDataSourceInterface

Base class for client-side DataSource implementations.

See Also:
Serialized Form

Field Summary
protected  java.lang.String connectionAttributes
           
private  boolean createDatabase
          Set to true if the database should be created.
private  java.lang.String databaseName
           
private  java.lang.String dataSourceName
           
private  java.lang.String description
           
private  int loginTimeout
          The time in seconds to wait for a connection request on this data source.
private  java.io.PrintWriter logWriter
          The log writer is declared transient, and is not serialized or stored under JNDI.
private  java.lang.String password
           
private  int portNumber
           
private  boolean retrieveMessageText
           
private static short SECMEC_HAS_NOT_EXPLICITLY_SET
           
protected  short securityMechanism
           
private static long serialVersionUID
           
private  java.lang.String serverName
           
private  boolean shutdownDatabase
          Set to true if the database should be shutdown.
static int SSL_BASIC
          The constant indicating that SSL encryption will be used.
private static java.lang.String SSL_BASIC_STR
           
static int SSL_OFF
          The constant indicating that SSL encryption won't be used.
private static java.lang.String SSL_OFF_STR
           
static int SSL_PEER_AUTHENTICATION
          The constant indicating that SSL encryption with peer authentication will be used.
private static java.lang.String SSL_PEER_AUTHENTICATION_STR
           
private  int sslMode
           
(package private) static boolean SUPPORTS_EUSRIDPWD
           
private  java.lang.String traceDirectory
           
private  java.lang.String traceFile
           
private  boolean traceFileAppend
           
private  int traceFileSuffixIndex_
           
protected  int traceLevel
           
private  java.lang.String user
           
 
Fields inherited from interface org.apache.derby.jdbc.ClientDataSourceInterface
CLEAR_TEXT_PASSWORD_SECURITY, ENCRYPTED_PASSWORD_SECURITY, ENCRYPTED_USER_AND_PASSWORD_SECURITY, propertyDefault_portNumber, propertyDefault_retrieveMessageText, propertyDefault_securityMechanism, propertyDefault_serverName, propertyDefault_traceFileAppend, propertyDefault_traceLevel, propertyDefault_user, STRONG_PASSWORD_SUBSTITUTE_SECURITY, TRACE_ALL, TRACE_CONNECTION_CALLS, TRACE_CONNECTS, TRACE_DIAGNOSTICS, TRACE_DRIVER_CONFIGURATION, TRACE_NONE, TRACE_PARAMETER_META_DATA, TRACE_PROTOCOL_FLOWS, TRACE_RESULT_SET_CALLS, TRACE_RESULT_SET_META_DATA, TRACE_STATEMENT_CALLS, TRACE_XA_CALLS, USER_ONLY_SECURITY
 
Constructor Summary
ClientBaseDataSourceRoot()
           
 
Method Summary
private static void checkBoolean(java.util.Properties set, java.lang.String attribute)
           
private static void checkEnumeration(java.util.Properties set, java.lang.String attribute, java.lang.String[] choices)
           
static LogWriter computeDncLogWriter(Connection connection, java.io.PrintWriter logWriter, java.lang.String traceDirectory, java.lang.String traceFile, boolean traceFileAppend, java.lang.String logWriterInUseSuffix, int traceFileSuffixIndex, int traceLevel)
           
(package private) static LogWriter computeDncLogWriter(java.io.PrintWriter logWriter, java.lang.String traceDirectory, java.lang.String traceFile, boolean traceFileAppend, java.lang.String logWriterInUseSuffix, int traceFileSuffixIndex, int traceLevel)
           
(package private) static LogWriter computeDncLogWriterForNewConnection(java.io.PrintWriter logWriter, java.lang.String traceDirectory, java.lang.String traceFile, boolean traceFileAppend, int traceLevel, java.lang.String logWriterInUseSuffix, int traceFileSuffixIndex)
           
(package private)  LogWriter computeDncLogWriterForNewConnection(java.lang.String logWriterInUseSuffix)
           
(package private) static java.io.PrintWriter computePrintWriter(java.io.PrintWriter logWriter, java.lang.String traceDirectory, java.lang.String traceFile, boolean traceFileAppend, java.lang.String logWriterInUseSuffix, int traceFileSuffixIndex)
           
private  java.lang.String constructUrl()
          Constructs the JDBC connection URL from the state of the data source.
static int getClientSSLMode(java.util.Properties properties)
          Returns the SSL mode specified by the property object.
 java.sql.Connection getConnection()
          Attempt to establish a database connection in a non-pooling, non-distributed environment.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Attempt to establish a database connection in a non-pooling, non-distributed environment.
 java.lang.String getConnectionAttributes()
           
private  java.sql.Connection getConnectionX(LogWriter dncLogWriter, java.lang.String user, java.lang.String password)
           
 java.lang.String getCreateDatabase()
           
 java.lang.String getDatabaseName()
           
 java.lang.String getDataSourceName()
           
 java.lang.String getDescription()
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getPassword()
           
static java.lang.String getPassword(java.util.Properties properties)
           
protected  javax.sql.PooledConnection getPooledConnectionMinion()
           
protected  javax.sql.PooledConnection getPooledConnectionMinion(java.lang.String user, java.lang.String password)
           
private static javax.sql.PooledConnection getPooledConnectionX(LogWriter dncLogWriter, ClientBaseDataSourceRoot ds, java.lang.String user, java.lang.String password)
           
 int getPortNumber()
           
static java.util.Properties getProperties(ClientBaseDataSourceRoot ths)
           
 boolean getRetrieveMessageText()
           
static boolean getRetrieveMessageText(java.util.Properties properties)
           
 short getSecurityMechanism()
          Return the security mechanism.
static short getSecurityMechanism(java.util.Properties properties)
          Return security mechanism if it is set, else upgrade the security mechanism if possible and return the upgraded security mechanism
 short getSecurityMechanism(java.lang.String password)
          Return the security mechanism for this datasource object.
 java.lang.String getServerName()
           
 java.lang.String getShutdownDatabase()
           
 java.lang.String getSsl()
          Returns the SSL encryption mode specified for the data source.
static int getSSLModeFromString(java.lang.String s)
          Parses the string and returns the corresponding constant for the SSL mode denoted.
 java.lang.String getTraceDirectory()
           
static java.lang.String getTraceDirectory(java.util.Properties properties)
          Check if derby.client.traceDirectory is provided as a JVM property.
 java.lang.String getTraceFile()
           
static java.lang.String getTraceFile(java.util.Properties properties)
           
 boolean getTraceFileAppend()
           
static boolean getTraceFileAppend(java.util.Properties properties)
           
 int getTraceLevel()
           
static int getTraceLevel(java.util.Properties properties)
          Check if derby.client.traceLevel is provided as a JVM property.
static short getUpgradedSecurityMechanism(java.lang.String password)
          This method has logic to upgrade security mechanism to a better (more secure) one if it is possible.
 java.lang.String getUser()
           
static java.lang.String getUser(java.util.Properties properties)
           
protected  javax.sql.XAConnection getXAConnectionMinion()
           
protected  javax.sql.XAConnection getXAConnectionMinion(java.lang.String user, java.lang.String password)
           
private static javax.sql.XAConnection getXAConnectionX(LogWriter dncLogWriter, ClientBaseDataSourceRoot ds, java.lang.String user, java.lang.String password)
          Method that establishes the initial physical connection using DS properties instead of CPDS properties.
protected  void handleConnectionException(LogWriter logWriter, SqlException sqle)
          Handles common error situations that can happen when trying to obtain a physical connection to the server, and which require special handling.
 boolean isWrapperFor(java.lang.Class<?> iface)
          Check whether this instance wraps an object that implements the interface specified by iface.
 int maxStatementsToPool()
          Returns the maximum number of JDBC prepared statements a connection is allowed to cache.
private static boolean parseBoolean(java.lang.String boolString, boolean defaultBool)
           
private static int parseInt(java.lang.String intString, int defaultInt)
           
private static java.lang.String parseString(java.lang.String string, java.lang.String defaultString)
           
private static java.lang.String readSystemProperty(java.lang.String key)
          Read the value of the passed system property.
 void setConnectionAttributes(java.lang.String prop)
          Set this property to pass in more Derby specific connection URL attributes.
 void setCreateDatabase(java.lang.String create)
          Set this property to create a new database.
 void setDatabaseName(java.lang.String databaseName)
           
 void setDataSourceName(java.lang.String dataSourceName)
           
 void setDescription(java.lang.String description)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter logWriter)
           
 void setPassword(java.lang.String password)
           
 void setPortNumber(int portNumber)
           
 void setRetrieveMessageText(boolean retrieveMessageText)
           
 void setSecurityMechanism(short securityMechanism)
          Sets the security mechanism.
 void setServerName(java.lang.String serverName)
           
 void setShutdownDatabase(java.lang.String shutdown)
          Set this property if one wishes to shutdown the database identified by databaseName.
 void setSsl(java.lang.String mode)
          Specifices the SSL encryption mode to use.
 void setTraceDirectory(java.lang.String traceDirectory)
           
 void setTraceFile(java.lang.String traceFile)
           
 void setTraceFileAppend(boolean traceFileAppend)
           
 void setTraceLevel(int traceLevel)
           
 void setUser(java.lang.String user)
           
(package private) static java.util.Properties tokenizeAttributes(java.lang.String attributeString, java.util.Properties properties)
           
<T> T
unwrap(java.lang.Class<T> iface)
          Returns this if this class implements the specified interface.
(package private)  void updateDataSourceValues(java.util.Properties prop)
          The dataSource keeps individual fields for the values that are relevant to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

SUPPORTS_EUSRIDPWD

static final boolean SUPPORTS_EUSRIDPWD

loginTimeout

private int loginTimeout
The time in seconds to wait for a connection request on this data source. The default value of zero indicates that either the system time out be used or no timeout limit.


logWriter

private transient java.io.PrintWriter logWriter
The log writer is declared transient, and is not serialized or stored under JNDI.

See Also:
traceLevel

databaseName

private java.lang.String databaseName

description

private java.lang.String description

dataSourceName

private java.lang.String dataSourceName

portNumber

private int portNumber

serverName

private java.lang.String serverName

SSL_OFF

public static final int SSL_OFF
The constant indicating that SSL encryption won't be used.

See Also:
Constant Field Values

SSL_OFF_STR

private static final java.lang.String SSL_OFF_STR
See Also:
Constant Field Values

SSL_BASIC

public static final int SSL_BASIC
The constant indicating that SSL encryption will be used.

See Also:
Constant Field Values

SSL_BASIC_STR

private static final java.lang.String SSL_BASIC_STR
See Also:
Constant Field Values

SSL_PEER_AUTHENTICATION

public static final int SSL_PEER_AUTHENTICATION
The constant indicating that SSL encryption with peer authentication will be used.

See Also:
Constant Field Values

SSL_PEER_AUTHENTICATION_STR

private static final java.lang.String SSL_PEER_AUTHENTICATION_STR
See Also:
Constant Field Values

user

private java.lang.String user

SECMEC_HAS_NOT_EXPLICITLY_SET

private static final short SECMEC_HAS_NOT_EXPLICITLY_SET
See Also:
Constant Field Values

securityMechanism

protected short securityMechanism

retrieveMessageText

private boolean retrieveMessageText

traceFile

private java.lang.String traceFile

traceFileSuffixIndex_

private transient int traceFileSuffixIndex_

traceDirectory

private java.lang.String traceDirectory

traceFileAppend

private boolean traceFileAppend

password

private java.lang.String password

sslMode

private int sslMode

createDatabase

private boolean createDatabase
Set to true if the database should be created.


shutdownDatabase

private boolean shutdownDatabase
Set to true if the database should be shutdown.


connectionAttributes

protected java.lang.String connectionAttributes

traceLevel

protected int traceLevel
Constructor Detail

ClientBaseDataSourceRoot

ClientBaseDataSourceRoot()
Method Detail

setLoginTimeout

public void setLoginTimeout(int seconds)
Specified by:
setLoginTimeout in interface javax.sql.CommonDataSource

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface javax.sql.CommonDataSource

setLogWriter

public void setLogWriter(java.io.PrintWriter logWriter)
Specified by:
setLogWriter in interface javax.sql.CommonDataSource

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.sql.CommonDataSource

getSSLModeFromString

public static int getSSLModeFromString(java.lang.String s)
                                throws SqlException
Parses the string and returns the corresponding constant for the SSL mode denoted.

Valid values are off, basic and peerAuthentication.

Parameters:
s - string denoting the SSL mode
Returns:
A constant indicating the SSL mode denoted by the string. If the string is null, SSL_OFF is returned.
Throws:
SqlException - if the string has an invalid value

getClientSSLMode

public static int getClientSSLMode(java.util.Properties properties)
                            throws SqlException
Returns the SSL mode specified by the property object.

Parameters:
properties - data source properties
Returns:
A constant indicating the SSL mode to use. Defaults to SSL_OFF if the SSL attribute isn't specified.
Throws:
SqlException - if an invalid value for the SSL mode is specified in the property object

getUser

public static java.lang.String getUser(java.util.Properties properties)

getSecurityMechanism

public static short getSecurityMechanism(java.util.Properties properties)
Return security mechanism if it is set, else upgrade the security mechanism if possible and return the upgraded security mechanism

Parameters:
properties - Look in the properties if securityMechanism is set or not if set, return this security mechanism
Returns:
security mechanism

getUpgradedSecurityMechanism

public static short getUpgradedSecurityMechanism(java.lang.String password)
This method has logic to upgrade security mechanism to a better (more secure) one if it is possible. Currently derby server only has support for USRIDPWD, USRIDONL, EUSRIDPWD and USRSSBPWD (10.2+) - this method only considers these possibilities. USRIDPWD, EUSRIDPWD and USRSSBPWD require a password, USRIDONL is the only security mechanism which does not require password. 1. if password is not available, then security mechanism possible is USRIDONL 2. if password is available,then USRIDPWD is returned.

Parameters:
password - password argument
Returns:
upgraded security mechanism if possible

getRetrieveMessageText

public static boolean getRetrieveMessageText(java.util.Properties properties)

getTraceFile

public static java.lang.String getTraceFile(java.util.Properties properties)

getTraceDirectory

public static java.lang.String getTraceDirectory(java.util.Properties properties)
Check if derby.client.traceDirectory is provided as a JVM property. If yes, then we use that value. If not, then we look for traceDirectory in the the properties parameter.

Parameters:
properties - jdbc url properties
Returns:
value of traceDirectory property

readSystemProperty

private static java.lang.String readSystemProperty(java.lang.String key)
Read the value of the passed system property.

Parameters:
key - name of the system property
Returns:
value of the system property, null if there is no permission to read the property

getTraceFileAppend

public static boolean getTraceFileAppend(java.util.Properties properties)

getPassword

public static java.lang.String getPassword(java.util.Properties properties)

setPassword

public final void setPassword(java.lang.String password)
Specified by:
setPassword in interface ClientDataSourceInterface

getPassword

public final java.lang.String getPassword()
Specified by:
getPassword in interface ClientDataSourceInterface

computeDncLogWriterForNewConnection

LogWriter computeDncLogWriterForNewConnection(java.lang.String logWriterInUseSuffix)
                                        throws SqlException
Throws:
SqlException

computeDncLogWriterForNewConnection

static LogWriter computeDncLogWriterForNewConnection(java.io.PrintWriter logWriter,
                                                     java.lang.String traceDirectory,
                                                     java.lang.String traceFile,
                                                     boolean traceFileAppend,
                                                     int traceLevel,
                                                     java.lang.String logWriterInUseSuffix,
                                                     int traceFileSuffixIndex)
                                              throws SqlException
Throws:
SqlException

computeDncLogWriter

static LogWriter computeDncLogWriter(java.io.PrintWriter logWriter,
                                     java.lang.String traceDirectory,
                                     java.lang.String traceFile,
                                     boolean traceFileAppend,
                                     java.lang.String logWriterInUseSuffix,
                                     int traceFileSuffixIndex,
                                     int traceLevel)
                              throws SqlException
Throws:
SqlException

computeDncLogWriter

public static LogWriter computeDncLogWriter(Connection connection,
                                            java.io.PrintWriter logWriter,
                                            java.lang.String traceDirectory,
                                            java.lang.String traceFile,
                                            boolean traceFileAppend,
                                            java.lang.String logWriterInUseSuffix,
                                            int traceFileSuffixIndex,
                                            int traceLevel)
                                     throws SqlException
Throws:
SqlException

computePrintWriter

static java.io.PrintWriter computePrintWriter(java.io.PrintWriter logWriter,
                                              java.lang.String traceDirectory,
                                              java.lang.String traceFile,
                                              boolean traceFileAppend,
                                              java.lang.String logWriterInUseSuffix,
                                              int traceFileSuffixIndex)
                                       throws SqlException
Throws:
SqlException

parseBoolean

private static boolean parseBoolean(java.lang.String boolString,
                                    boolean defaultBool)

parseString

private static java.lang.String parseString(java.lang.String string,
                                            java.lang.String defaultString)

parseInt

private static int parseInt(java.lang.String intString,
                            int defaultInt)

tokenizeAttributes

static java.util.Properties tokenizeAttributes(java.lang.String attributeString,
                                               java.util.Properties properties)
                                        throws SqlException
Throws:
SqlException

checkBoolean

private static void checkBoolean(java.util.Properties set,
                                 java.lang.String attribute)
                          throws SqlException
Throws:
SqlException

checkEnumeration

private static void checkEnumeration(java.util.Properties set,
                                     java.lang.String attribute,
                                     java.lang.String[] choices)
                              throws SqlException
Throws:
SqlException

setDatabaseName

public void setDatabaseName(java.lang.String databaseName)
Specified by:
setDatabaseName in interface ClientDataSourceInterface

getDatabaseName

public java.lang.String getDatabaseName()
Specified by:
getDatabaseName in interface ClientDataSourceInterface

setDataSourceName

public void setDataSourceName(java.lang.String dataSourceName)
Specified by:
setDataSourceName in interface ClientDataSourceInterface

getDataSourceName

public java.lang.String getDataSourceName()
Specified by:
getDataSourceName in interface ClientDataSourceInterface

setDescription

public void setDescription(java.lang.String description)
Specified by:
setDescription in interface ClientDataSourceInterface

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface ClientDataSourceInterface

setPortNumber

public void setPortNumber(int portNumber)
Specified by:
setPortNumber in interface ClientDataSourceInterface

getPortNumber

public int getPortNumber()
Specified by:
getPortNumber in interface ClientDataSourceInterface

setServerName

public void setServerName(java.lang.String serverName)
Specified by:
setServerName in interface ClientDataSourceInterface

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface ClientDataSourceInterface

setUser

public void setUser(java.lang.String user)
Specified by:
setUser in interface ClientDataSourceInterface

getUser

public java.lang.String getUser()
Specified by:
getUser in interface ClientDataSourceInterface

setRetrieveMessageText

public void setRetrieveMessageText(boolean retrieveMessageText)
Specified by:
setRetrieveMessageText in interface ClientDataSourceInterface

getRetrieveMessageText

public boolean getRetrieveMessageText()
Specified by:
getRetrieveMessageText in interface ClientDataSourceInterface

setSecurityMechanism

public void setSecurityMechanism(short securityMechanism)
Sets the security mechanism.

Specified by:
setSecurityMechanism in interface ClientDataSourceInterface
Parameters:
securityMechanism - to set

getSecurityMechanism

public short getSecurityMechanism()
Return the security mechanism. If security mechanism has not been set explicitly on datasource, then upgrade the security mechanism to a more secure one if possible.

Specified by:
getSecurityMechanism in interface ClientDataSourceInterface
Returns:
the security mechanism
See Also:
getUpgradedSecurityMechanism(String)

getSecurityMechanism

public short getSecurityMechanism(java.lang.String password)
Return the security mechanism for this datasource object. If security mechanism has not been set explicitly on datasource, then upgrade the security mechanism to a more secure one if possible.

Specified by:
getSecurityMechanism in interface ClientDataSourceInterface
Parameters:
password - password of user
Returns:
the security mechanism
See Also:
getUpgradedSecurityMechanism(String)

setSsl

public void setSsl(java.lang.String mode)
            throws SqlException
Specifices the SSL encryption mode to use.

Valid values are off, basic and peerAuthentication.

Specified by:
setSsl in interface ClientDataSourceInterface
Parameters:
mode - the SSL mode to use (off, basic or peerAuthentication)
Throws:
SqlException - if the specified mode is invalid

getSsl

public java.lang.String getSsl()
Returns the SSL encryption mode specified for the data source.

Specified by:
getSsl in interface ClientDataSourceInterface
Returns:
off, basic or peerAuthentication.

setCreateDatabase

public final void setCreateDatabase(java.lang.String create)
Set this property to create a new database. If this property is not set, the database (identified by databaseName) is assumed to be already existing.

Specified by:
setCreateDatabase in interface ClientDataSourceInterface
Parameters:
create - if set to the string "create", this data source will try to create a new database of databaseName, or boot the database if one by that name already exists.

getCreateDatabase

public final java.lang.String getCreateDatabase()
Specified by:
getCreateDatabase in interface ClientDataSourceInterface
Returns:
"create" if create is set, or null if not

setShutdownDatabase

public final void setShutdownDatabase(java.lang.String shutdown)
Set this property if one wishes to shutdown the database identified by databaseName.

Specified by:
setShutdownDatabase in interface ClientDataSourceInterface
Parameters:
shutdown - if set to the string "shutdown", this data source will shutdown the database if it is running.

getShutdownDatabase

public final java.lang.String getShutdownDatabase()
Specified by:
getShutdownDatabase in interface ClientDataSourceInterface
Returns:
"shutdown" if shutdown is set, or null if not

setConnectionAttributes

public final void setConnectionAttributes(java.lang.String prop)
Set this property to pass in more Derby specific connection URL attributes.
Any attributes that can be set using a property of this DataSource implementation (e.g user, password) should not be set in connectionAttributes. Conflicting settings in connectionAttributes and properties of the DataSource will lead to unexpected behaviour.

Specified by:
setConnectionAttributes in interface ClientDataSourceInterface
Parameters:
prop - set to the list of Derby connection attributes separated by semi-colons. E.g., to specify an encryption bootPassword of "x8hhk2adf", and set upgrade to true, do the following:
ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true"); See Derby documentation for complete list.

getConnectionAttributes

public final java.lang.String getConnectionAttributes()
Specified by:
getConnectionAttributes in interface ClientDataSourceInterface
Returns:
Derby specific connection URL attributes

getTraceLevel

public static int getTraceLevel(java.util.Properties properties)
Check if derby.client.traceLevel is provided as a JVM property. If yes, then we use that value. If not, then we look for traceLevel in the the properties parameter.

Parameters:
properties - jdbc url properties
Returns:
value of traceLevel property

setTraceLevel

public void setTraceLevel(int traceLevel)
Specified by:
setTraceLevel in interface ClientDataSourceInterface

getTraceLevel

public int getTraceLevel()
Specified by:
getTraceLevel in interface ClientDataSourceInterface

setTraceFile

public void setTraceFile(java.lang.String traceFile)
Specified by:
setTraceFile in interface ClientDataSourceInterface

getTraceFile

public java.lang.String getTraceFile()
Specified by:
getTraceFile in interface ClientDataSourceInterface

setTraceDirectory

public void setTraceDirectory(java.lang.String traceDirectory)
Specified by:
setTraceDirectory in interface ClientDataSourceInterface

getTraceDirectory

public java.lang.String getTraceDirectory()
Specified by:
getTraceDirectory in interface ClientDataSourceInterface

setTraceFileAppend

public void setTraceFileAppend(boolean traceFileAppend)
Specified by:
setTraceFileAppend in interface ClientDataSourceInterface

getTraceFileAppend

public boolean getTraceFileAppend()
Specified by:
getTraceFileAppend in interface ClientDataSourceInterface

maxStatementsToPool

public int maxStatementsToPool()
Returns the maximum number of JDBC prepared statements a connection is allowed to cache.

A basic data source will always return zero. If statement caching is required, use a ConnectionPoolDataSource.

This method is used internally by Derby to determine if statement pooling is to be enabled or not. Not part of public API, so not present in ClientDataSourceInterface.

Returns:
Maximum number of statements to cache, or 0 if caching is disabled (default).

updateDataSourceValues

void updateDataSourceValues(java.util.Properties prop)
                      throws SqlException
The dataSource keeps individual fields for the values that are relevant to the client. These need to be updated when set connection attributes is called.

Throws:
SqlException

handleConnectionException

protected final void handleConnectionException(LogWriter logWriter,
                                               SqlException sqle)
                                        throws java.sql.SQLException
Handles common error situations that can happen when trying to obtain a physical connection to the server, and which require special handling.

If this method returns normally, the exception wasn't handled and should be handled elsewhere or be re-thrown.

Parameters:
logWriter - log writer, may be null
sqle - exception to handle
Throws:
java.sql.SQLException - handled exception (if any)

constructUrl

private java.lang.String constructUrl()
Constructs the JDBC connection URL from the state of the data source.

Returns:
The JDBC connection URL.

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Attempt to establish a database connection in a non-pooling, non-distributed environment.

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs.

getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Attempt to establish a database connection in a non-pooling, non-distributed environment.

Specified by:
getConnection in interface javax.sql.DataSource
Parameters:
user - the database user on whose behalf the Connection is being made
password - the user's password
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs.

getConnectionX

private java.sql.Connection getConnectionX(LogWriter dncLogWriter,
                                           java.lang.String user,
                                           java.lang.String password)
                                    throws SqlException
Throws:
SqlException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
Check whether this instance wraps an object that implements the interface specified by iface.

Specified by:
isWrapperFor in interface java.sql.Wrapper
Parameters:
iface - a class defining an interface
Returns:
true if this instance implements iface, or false otherwise
Throws:
java.sql.SQLException - if an error occurs while determining if this instance implements iface

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException
Returns this if this class implements the specified interface.

Specified by:
unwrap in interface java.sql.Wrapper
Parameters:
iface - a class defining an interface
Returns:
an object that implements the interface
Throws:
java.sql.SQLException - if no object is found that implements the interface

getPooledConnectionMinion

protected final javax.sql.PooledConnection getPooledConnectionMinion()
                                                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getPooledConnectionMinion

protected final javax.sql.PooledConnection getPooledConnectionMinion(java.lang.String user,
                                                                     java.lang.String password)
                                                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getPooledConnectionX

private static javax.sql.PooledConnection getPooledConnectionX(LogWriter dncLogWriter,
                                                               ClientBaseDataSourceRoot ds,
                                                               java.lang.String user,
                                                               java.lang.String password)
                                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getXAConnectionMinion

protected final javax.sql.XAConnection getXAConnectionMinion()
                                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getXAConnectionMinion

protected final javax.sql.XAConnection getXAConnectionMinion(java.lang.String user,
                                                             java.lang.String password)
                                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getXAConnectionX

private static javax.sql.XAConnection getXAConnectionX(LogWriter dncLogWriter,
                                                       ClientBaseDataSourceRoot ds,
                                                       java.lang.String user,
                                                       java.lang.String password)
                                                throws java.sql.SQLException
Method that establishes the initial physical connection using DS properties instead of CPDS properties.

Throws:
java.sql.SQLException

getProperties

public static java.util.Properties getProperties(ClientBaseDataSourceRoot ths)

Built on Wed 2013-06-12 15:21:56+0000, from revision ???

Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.