Accessing the Network Server by using the network client driver

When connecting to the Network Server, your application needs to load a driver and connection URL that is specific to the Network Server. In addition, you must specify a user name and password if you are using authentication.

The driver that you need to access the Network Server is:
org.apache.derby.jdbc.ClientDriver
The syntax of the URL that is required to access the Network Server is:
jdbc:derby://<server>[:<port>]/
<databaseName>[;<URL attribute>=<value> [;...]]
where the <URL attribute> is either a Derby embedded or network client attribute.
Table 1. Standard JDBC DataSource properties
Property Type Description URL attribute Notes
databaseName String The name of the database. This property is required.   This property is also available using EmbeddedDataSource.
dataSourceName String The data source name.   This property is also available using EmbeddedDataSource.
description String A description of the data source.   This property is also available using EmbeddedDataSource.
user String The user's account name. user Default is APP. This property is also available using EmbeddedDataSource.
password String The user's database password. password This property is also available using EmbeddedDataSource.
serverName String The host name or TCP/IP address where the server is listening for requests.   Default is "localhost".
portNumber Integer The port number where the server is listening for requests.   Default is "1527".
Table 2. Client-specific DataSource properties
Property Type Description URL attribute Notes
traceFile String The filename for tracing output. Setting this property turns on tracing. See Network client tracing. traceFile  
traceDirectory String The directory for the tracing output. Each connection will send output to a separate file. Setting this property turns on tracing. See Network client tracing. traceDirectory  
traceLevel Integer The level of client tracing if traceFile or traceDirectory are set. traceLevel The default is TRACE_ALL.
traceFileAppend Boolean Value is true if tracing output should append to the existing trace file. traceFileAppend The default is false.
securityMechanism Integer The security mechanism. See Network client security. securityMechanism The default is USER_ONLY _SECURITY.
retrieveMessageText Boolean Retrieve message text from the server. A stored procedure is called to retrieve the message text with each SQLException and might start a new unit of work. Set this property to false if you do not want the performance impact or when starting new units of work. retrieveMessageText The default is true.
Table 3. Server-Specific DataSource properties
Property Type Description URL attributes Notes
connectionAttributes String Set to the list of Derby embedded connection attributes separated by semicolons. Various This property is also available using EmbeddedDataSource. See the Derby Reference Manual for more information about the various connection attributes.

Note that setAttributesAsPassword , which is available for the embedded DataSource, is not available for the client DataSource.

Related concepts
The Network Server and JVMs
Accessing the Network Server by using a DataSource
XA and the Network Server
Using the Derby tools with the Network Server
Differences between running Derby in embedded mode and using the Network Server
Related tasks
Installing required jar files and adding them to the classpath
Starting the Network Server
Shutting down the Network Server
Obtaining system information
Setting port numbers