public class BasicClientDataSource40 extends Object implements DataSource, org.apache.derby.jdbc.ClientDataSourceInterface, Serializable
javax.naming.Referenceable.
* The standard attributes provided are, cf. e.g. table
9.1 in the JDBC 4.2 specification.
| Modifier and Type | Field and Description |
|---|---|
static String |
className__ |
static short |
CLEAR_TEXT_PASSWORD_SECURITY
See documentation at
USER_ONLY_SECURITY |
static short |
ENCRYPTED_PASSWORD_SECURITY
See documentation at
USER_ONLY_SECURITY |
static short |
ENCRYPTED_USER_AND_PASSWORD_SECURITY
See documentation at
USER_ONLY_SECURITY |
static int |
propertyDefault_traceLevel
See documentation at
TRACE_NONE. |
static int |
SSL_BASIC
The constant indicating that SSL encryption will be used.
|
static int |
SSL_OFF
The constant indicating that SSL encryption won't be used.
|
static int |
SSL_PEER_AUTHENTICATION
The constant indicating that SSL encryption with peer authentication
will be used.
|
static short |
STRONG_PASSWORD_SUBSTITUTE_SECURITY
See documentation at
USER_ONLY_SECURITY |
static int |
TRACE_ALL
See documentation at
TRACE_NONE. |
static int |
TRACE_CONNECTION_CALLS
See documentation at
TRACE_NONE. |
static int |
TRACE_CONNECTS
See documentation at
TRACE_NONE. |
static int |
TRACE_DIAGNOSTICS
See documentation at
TRACE_NONE. |
static int |
TRACE_DRIVER_CONFIGURATION
See documentation at
TRACE_NONE. |
static int |
TRACE_NONE
The client server protocol can be traced.
|
static int |
TRACE_PARAMETER_META_DATA
See documentation at
TRACE_NONE. |
static int |
TRACE_PROTOCOL_FLOWS
See documentation at
TRACE_NONE. |
static int |
TRACE_RESULT_SET_CALLS
See documentation at
TRACE_NONE. |
static int |
TRACE_RESULT_SET_META_DATA
See documentation at
TRACE_NONE. |
static int |
TRACE_STATEMENT_CALLS
See documentation at
TRACE_NONE. |
static int |
TRACE_XA_CALLS
See documentation at
TRACE_NONE. |
static short |
USER_ONLY_SECURITY
The source security mechanism to use when connecting to a client data
source.
|
| Constructor and Description |
|---|
BasicClientDataSource40()
Creates a simple DERBY data source with default property values
for a non-pooling, non-distributed environment.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
getClientSSLMode(Properties properties)
Returns the SSL mode specified by the property object.
|
Connection |
getConnection()
Attempt to establish a database connection in a non-pooling,
non-distributed environment.
|
Connection |
getConnection(String user,
String password)
Attempt to establish a database connection in a non-pooling,
non-distributed environment.
|
String |
getConnectionAttributes() |
String |
getCreateDatabase() |
String |
getDatabaseName() |
String |
getDataSourceName() |
String |
getDescription() |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
String |
getPassword() |
static String |
getPassword(Properties properties) |
int |
getPortNumber() |
static Properties |
getProperties(BasicClientDataSource40 ths) |
boolean |
getRetrieveMessageText() |
static boolean |
getRetrieveMessageText(Properties properties) |
short |
getSecurityMechanism()
Return the security mechanism.
|
static short |
getSecurityMechanism(Properties properties)
Return security mechanism if it is set, else upgrade the security
mechanism if possible and return the upgraded security mechanism
|
short |
getSecurityMechanism(String password)
Return the security mechanism for this datasource object.
|
String |
getServerName() |
String |
getShutdownDatabase() |
String |
getSsl()
Returns the SSL encryption mode specified for the data source.
|
static int |
getSSLModeFromString(String s)
Parses the string and returns the corresponding constant for the SSL
mode denoted.
|
String |
getTraceDirectory() |
String |
getTraceFile() |
boolean |
getTraceFileAppend() |
int |
getTraceLevel() |
String |
getUser() |
static String |
getUser(Properties properties) |
boolean |
isWrapperFor(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.
|
void |
setConnectionAttributes(String prop)
Set this property to pass in more Derby specific connection URL
attributes.
|
void |
setCreateDatabase(String create)
Set this property to create a new database.
|
void |
setDatabaseName(String databaseName) |
void |
setDataSourceName(String dataSourceName) |
void |
setDescription(String description) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter logWriter) |
void |
setPassword(String password) |
void |
setPortNumber(int portNumber) |
void |
setRetrieveMessageText(boolean retrieveMessageText) |
void |
setSecurityMechanism(short securityMechanism)
Sets the security mechanism.
|
void |
setServerName(String serverName) |
void |
setShutdownDatabase(String shutdown)
Set this property if one wishes to shutdown the database identified by
databaseName.
|
void |
setSsl(String mode)
Specifies the SSL encryption mode to use.
|
void |
setTraceDirectory(String traceDirectory) |
void |
setTraceFile(String traceFile) |
void |
setTraceFileAppend(boolean traceFileAppend) |
void |
setTraceLevel(int traceLevel) |
void |
setUser(String user) |
<T> T |
unwrap(Class<T> iface)
Returns
this if this class implements the specified interface. |
public static final String className__
public static final int TRACE_NONE
traceLevel.
TRACE_NONE TRACE_CONNECTION_CALLS TRACE_STATEMENT_CALLS TRACE_RESULT_SET_CALLS TRACE _DRIVER_CONFIGURATION TRACE_CONNECTS TRACE_PROTOCOL_FLOWS TRACE _RESULT_SET_META_DATA TRACE _PARAMETER_META_DATA TRACE_DIAGNOSTICS TRACE_XA_CALLS TRACE_ALL
public static final int TRACE_CONNECTION_CALLS
TRACE_NONE.public static final int TRACE_STATEMENT_CALLS
TRACE_NONE.public static final int TRACE_RESULT_SET_CALLS
TRACE_NONE.public static final int TRACE_DRIVER_CONFIGURATION
TRACE_NONE.public static final int TRACE_CONNECTS
TRACE_NONE.public static final int TRACE_PROTOCOL_FLOWS
TRACE_NONE.public static final int TRACE_RESULT_SET_META_DATA
TRACE_NONE.public static final int TRACE_PARAMETER_META_DATA
TRACE_NONE.public static final int TRACE_DIAGNOSTICS
TRACE_NONE.public static final int TRACE_XA_CALLS
TRACE_NONE.public static final int TRACE_ALL
TRACE_NONE.public static final int propertyDefault_traceLevel
TRACE_NONE.public static final short USER_ONLY_SECURITY
public static final short CLEAR_TEXT_PASSWORD_SECURITY
USER_ONLY_SECURITYpublic static final short ENCRYPTED_PASSWORD_SECURITY
USER_ONLY_SECURITYpublic static final short ENCRYPTED_USER_AND_PASSWORD_SECURITY
USER_ONLY_SECURITYpublic static final short STRONG_PASSWORD_SUBSTITUTE_SECURITY
USER_ONLY_SECURITYpublic static final int SSL_OFF
public static final int SSL_BASIC
public static final int SSL_PEER_AUTHENTICATION
public BasicClientDataSource40()
public void setLoginTimeout(int seconds)
setLoginTimeout in interface CommonDataSourcepublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic void setLogWriter(PrintWriter logWriter)
setLogWriter in interface CommonDataSourcepublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcepublic static int getSSLModeFromString(String s) throws org.apache.derby.client.am.SqlException
Valid values are off, basic and peerAuthentication.
s - string denoting the SSL modenull, SSL_OFF is returned.org.apache.derby.client.am.SqlException - if the string has an invalid valuepublic static int getClientSSLMode(Properties properties) throws org.apache.derby.client.am.SqlException
properties - data source propertiesSSL_OFF if the SSL attribute isn't specified.org.apache.derby.client.am.SqlException - if an invalid value for the SSL mode is specified
in the property objectpublic static String getUser(Properties properties)
public static short getSecurityMechanism(Properties properties)
properties - Look in the properties if securityMechanism is set
or not
if set, return this security mechanismpublic static boolean getRetrieveMessageText(Properties properties)
public static String getPassword(Properties properties)
public void setPassword(String password)
setPassword in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getPassword()
getPassword in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setDatabaseName(String databaseName)
setDatabaseName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getDatabaseName()
getDatabaseName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setDataSourceName(String dataSourceName)
setDataSourceName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getDataSourceName()
getDataSourceName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setDescription(String description)
setDescription in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getDescription()
getDescription in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setPortNumber(int portNumber)
setPortNumber in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic int getPortNumber()
getPortNumber in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setServerName(String serverName)
setServerName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getServerName()
getServerName in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setUser(String user)
setUser in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getUser()
getUser in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setRetrieveMessageText(boolean retrieveMessageText)
setRetrieveMessageText in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic boolean getRetrieveMessageText()
getRetrieveMessageText in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setSecurityMechanism(short securityMechanism)
setSecurityMechanism in interface org.apache.derby.jdbc.ClientDataSourceInterfacesecurityMechanism - to setpublic short getSecurityMechanism()
getSecurityMechanism in interface org.apache.derby.jdbc.ClientDataSourceInterfacegetUpgradedSecurityMechanism(String)public short getSecurityMechanism(String password)
getSecurityMechanism in interface org.apache.derby.jdbc.ClientDataSourceInterfacepassword - password of usergetUpgradedSecurityMechanism(String)public void setSsl(String mode) throws org.apache.derby.client.am.SqlException
Valid values are off, basic and peerAuthentication.
setSsl in interface org.apache.derby.jdbc.ClientDataSourceInterfacemode - the SSL mode to use (off, basic or
peerAuthentication)org.apache.derby.client.am.SqlException - if the specified mode is invalidpublic String getSsl()
getSsl in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setCreateDatabase(String create)
setCreateDatabase in interface org.apache.derby.jdbc.ClientDataSourceInterfacecreate - 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.public String getCreateDatabase()
getCreateDatabase in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setShutdownDatabase(String shutdown)
setShutdownDatabase in interface org.apache.derby.jdbc.ClientDataSourceInterfaceshutdown - if set to the string "shutdown", this data source will
shutdown the database if it is running.public String getShutdownDatabase()
getShutdownDatabase in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setConnectionAttributes(String prop)
setConnectionAttributes in interface org.apache.derby.jdbc.ClientDataSourceInterfaceprop - 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.public String getConnectionAttributes()
getConnectionAttributes in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setTraceLevel(int traceLevel)
setTraceLevel in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic int getTraceLevel()
getTraceLevel in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setTraceFile(String traceFile)
setTraceFile in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getTraceFile()
getTraceFile in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setTraceDirectory(String traceDirectory)
setTraceDirectory in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic String getTraceDirectory()
getTraceDirectory in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic void setTraceFileAppend(boolean traceFileAppend)
setTraceFileAppend in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic boolean getTraceFileAppend()
getTraceFileAppend in interface org.apache.derby.jdbc.ClientDataSourceInterfacepublic int maxStatementsToPool()
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.
0 if
caching is disabled (default).public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLException - if a database-access error occurs.public Connection getConnection(String user, String password) throws SQLException
getConnection in interface DataSourceuser - the database user on whose behalf the Connection is being
madepassword - the user's passwordSQLException - if a database-access error occurs.public boolean isWrapperFor(Class<?> iface) throws SQLException
iface.isWrapperFor in interface Wrapperiface - a class defining an interfacetrue if this instance implements iface, or
false otherwiseSQLException - if an error occurs while determining if this
instance implements ifacepublic <T> T unwrap(Class<T> iface) throws SQLException
this if this class implements the specified interface.unwrap in interface Wrapperiface - a class defining an interfaceSQLException - if no object is found that implements the
interfacepublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic static Properties getProperties(BasicClientDataSource40 ths)
Apache Derby 10.14 API Documentation - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.