handleConnectionException(org.apache.derby.client.am.LogWriter logWriter,
org.apache.derby.client.am.SqlException sqle)
Handles common error situations that can happen when trying to
obtain a physical connection to the server, and which require special
handling.

int

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

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.

propertyDefault_traceFileAppend

USER_ONLY_SECURITY

The source security mechanism to use when connecting to this data source.

Security mechanism options are:

USER_ONLY_SECURITY

CLEAR_TEXT_PASSWORD_SECURITY

ENCRYPTED_PASSWORD_SECURITY

ENCRYPTED_USER_AND_PASSWORD_SECURITY - both password and user are encrypted

STRONG_PASSWORD_SUBSTITUTE_SECURITY

The default security mechanism is USER_ONLY SECURITY

If the application specifies a security mechanism then it will be the only one attempted. If the specified
security mechanism is not supported by the conversation then an exception will be thrown and there will be no
additional retries.

This property is currently only available for the DNC driver.

Both user and password need to be set for all security mechanism except USER_ONLY_SECURITY

getUser

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.

org.apache.derby.client.am.SqlException - if the specified mode is invalid

getSsl

public java.lang.String getSsl()

Returns the SSL encryption mode specified for the data source.

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.

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()

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.

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()

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.

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()

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)

getTraceLevel

public int getTraceLevel()

setTraceFile

public void setTraceFile(java.lang.String traceFile)

getTraceFile

public java.lang.String getTraceFile()

setTraceDirectory

public void setTraceDirectory(java.lang.String traceDirectory)

getTraceDirectory

public java.lang.String getTraceDirectory()

setTraceFileAppend

public void setTraceFileAppend(boolean traceFileAppend)

getTraceFileAppend

public boolean getTraceFileAppend()

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.

Returns:

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