This data source is suitable for client/server use of Derby, running on Java 8 Compact Profile 2 or higher.
BasicClientDataSource is similar to ClientDataSource except it
can not be used with JNDI, i.e. it does not implement
javax.naming.Referenceable.
* The standard attributes provided are, cf. e.g. table 9.1 in the JDBC 4.2 specification.
These standard attributes are not supported:
The Derby client driver also supports these attributes:
Cloned from BasicClientDataSource40, which is now just an empty shell.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final short | |
| private String | |
| private boolean | createDatabase
Set to true if the database should be created. |
| private String | databaseName
Stores the relational database name, RDBNAME. |
| private String | dataSourceName
A data source name; used to name an underlying XADataSource, or ConnectionPoolDataSource when pooling of connections is done. |
| private String | description
A description of this data source. |
| public static final short | |
| public static final short | |
| private int | loginTimeout
The time in seconds to wait for a connection request on this data source. |
| private transient PrintWriter | logWriter
The log writer is declared transient, and is not serialized or stored under JNDI. |
| private String | |
| private int | |
| public static final int | propertyDefault_traceLevel
See documentation at |
| private boolean | |
| private static final short | |
| private short | securityMechanism
Security Mechanism can be specified explicitly either when obtaining a connection via a DriverManager or via Datasource. |
| private static final long | |
| private String | |
| private boolean | shutdownDatabase
Set to true if the database should be shutdown. |
| public static final int | SSL_BASIC
The constant indicating that SSL encryption will be used. |
| private static final String | |
| public static final int | SSL_OFF
The constant indicating that SSL encryption won't be used. |
| private static final String | |
| public static final int | SSL_PEER_AUTHENTICATION
The constant indicating that SSL encryption with peer authentication will be used. |
| private static final String | |
| private int | |
| public static final short | |
| public static final int | TRACE_ALL
See documentation at |
| public static final int | TRACE_CONNECTION_CALLS
See documentation at |
| public static final int | TRACE_CONNECTS
See documentation at |
| public static final int | TRACE_DIAGNOSTICS
See documentation at |
| public static final int | TRACE_DRIVER_CONFIGURATION
See documentation at |
| public static final int | TRACE_NONE
The client server protocol can be traced. |
| public static final int | TRACE_PARAMETER_META_DATA
See documentation at |
| public static final int | TRACE_PROTOCOL_FLOWS
See documentation at |
| public static final int | TRACE_RESULT_SET_CALLS
See documentation at |
| public static final int | TRACE_RESULT_SET_META_DATA
See documentation at |
| public static final int | TRACE_STATEMENT_CALLS
See documentation at |
| public static final int | TRACE_XA_CALLS
See documentation at |
| private String | |
| private String | |
| private boolean | |
| private transient int | |
| private int | |
| private String | user
This property can be overwritten by specifing the username parameter on the DataSource.getConnection() method call. |
| public static final short | USER_ONLY_SECURITY
Hides org. The source security mechanism to use when connecting to a client data source. |
| Access | Constructor and Description |
|---|---|
| public | BasicClientDataSource()
Creates a simple DERBY data source with default property values for a non-pooling, non-distributed environment. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private static void | |
| private static LogWriter | computeDncLogWriter(PrintWriter logWriter, String traceDirectory, String traceFile, boolean traceFileAppend, String logWriterInUseSuffix, int traceFileSuffixIndex, int traceLevel)
|
| private LogWriter | |
| public static LogWriter | computeDncLogWriterForNewConnection(PrintWriter logWriter, String traceDirectory, String traceFile, boolean traceFileAppend, int traceLevel, String logWriterInUseSuffix, int traceFileSuffixIndex)
|
| private static PrintWriter | computePrintWriter(PrintWriter logWriter, String traceDirectory, String traceFile, boolean traceFileAppend, String logWriterInUseSuffix, int traceFileSuffixIndex)
|
| private String | Returns: The JDBC connection URL.Constructs the JDBC connection URL from the state of the data source. |
| public static int | Returns: A constant indicating the SSL mode to use. Defaults toSSL_OFF if the SSL attribute isn't specified.data source properties properties)Returns the SSL mode specified by the property object. |
| public Connection | Returns: a Connection to the databaseImplements javax. |
| public Connection | Returns: a Connection to the databasethe database user on whose behalf the Connection is being
made user, String the user's password password)Implements javax. |
| public String | Returns: Derby specific connection URL attributesImplements org. |
| private Connection | |
| public String | Returns: "create" if create is set, or null if notImplements org. |
| public String | |
| public String | |
| public String | |
| public int | getLoginTimeout()
Implements javax. |
| public PrintWriter | getLogWriter()
Implements javax. Retrieves the log writer for this |
| public Logger | getParentLogger()
Implements javax. |
| public static String | |
| public String | |
| protected final PooledConnection | |
| protected final PooledConnection | |
| private static PooledConnection | getPooledConnectionX(LogWriter dncLogWriter, BasicClientDataSource ds, String user, String password)
|
| public int | |
| private static PrintWriter | |
| public static Properties | |
| public static boolean | |
| public boolean | |
| public static short | Returns: security mechanismLook in the properties if securityMechanism is set
or not
if set, return this security mechanism properties)Return security mechanism if it is set, else upgrade the security mechanism if possible and return the upgraded security mechanism |
| public short | Returns: the security mechanismImplements org. |
| public short | Returns: the security mechanismpassword of user password)Implements org. |
| public String | |
| public String | Returns: "shutdown" if shutdown is set, or null if notImplements org. |
| public String | Returns: off, basic or peerAuthentication.Implements org. |
| public static int | Returns: A constant indicating the SSL mode denoted by the string. If the string isnull, SSL_OFF is returned.string denoting the SSL mode s)Parses the string and returns the corresponding constant for the SSL mode denoted. |
| public static String | Returns: value of traceDirectory propertyjdbc url properties properties)Check if derby.client.traceDirectory is provided as a JVM property. |
| public String | |
| public static String | |
| public String | |
| public static boolean | |
| public boolean | |
| public static int | Returns: value of traceLevel propertyjdbc url properties properties)Check if derby.client.traceLevel is provided as a JVM property. |
| public int | |
| private static short | Returns: upgraded security mechanism if possiblepassword argument password)This method has logic to upgrade security mechanism to a better (more secure) one if it is possible. |
| public static String | |
| public String | |
| protected final XAConnection | |
| protected final XAConnection | |
| private static XAConnection | getXAConnectionX(LogWriter dncLogWriter, BasicClientDataSource ds, String user, String password)
Method that establishes the initial physical connection using DS properties instead of CPDS properties. |
| private void | handleConnectionException(LogWriter
log writer, may be logWriter, SqlException nullexception to handle sqle)Handles common error situations that can happen when trying to obtain a physical connection to the server, and which require special handling. |
| public boolean | Returns: true if this instance implements iface, or
false otherwisea class defining an interface iface)Implements java. iface.
|
| public int | Returns: Maximum number of statements to cache, or0 if
caching is disabled (default).Returns the maximum number of JDBC prepared statements a connection is allowed to cache. |
| private static boolean | |
| private static int | |
| private static String | |
| private static String | Returns: value of the system property, null if there is no permission to read the propertyname of the system property key)Read the value of the passed system property. |
| public void | setConnectionAttributes(String
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:
prop)ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true");
See Derby documentation for complete list.Implements org. |
| public void | setCreateDatabase(String
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. create)Implements org. |
| public synchronized void | setDatabaseName(String databaseName)
Implements org. |
| public synchronized void | setDataSourceName(String dataSourceName)
Implements org. |
| public synchronized void | setDescription(String description)
Implements org. |
| public synchronized void | setLoginTimeout(int
the data source login time limit seconds)Implements javax. Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |
| public synchronized void | setLogWriter(PrintWriter
the new log writer; to disable logging, set to null logWriter)Implements javax. Sets the log writer for this |
| public synchronized void | setPassword(String password)
Implements org. |
| public synchronized void | setPortNumber(int portNumber)
Implements org. |
| public synchronized void | setRetrieveMessageText(boolean retrieveMessageText)
Implements org. |
| public synchronized void | setSecurityMechanism(short
to set securityMechanism)Implements org. |
| public synchronized void | setServerName(String serverName)
Implements org. |
| public void | setShutdownDatabase(String
if set to the string "shutdown", this data source will
shutdown the database if it is running. shutdown)Implements org. |
| public void | setSsl(String
the SSL mode to use (off, basic or
peerAuthentication) mode)Implements org. |
| public synchronized void | setTraceDirectory(String traceDirectory)
Implements org. |
| public synchronized void | setTraceFile(String traceFile)
Implements org. |
| public synchronized void | setTraceFileAppend(boolean traceFileAppend)
Implements org. |
| public synchronized void | setTraceLevel(int traceLevel)
Implements org. |
| public synchronized void | |
| public static Properties | |
| public <T> T | Returns: an object that implements the interfacea class defining an interface iface)Implements java. this if this class implements the specified interface.
|
| private void | updateDataSourceValues(Properties prop)
The dataSource keeps individual fields for the values that are relevant to the client. |