# 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.

For both driver and DataSource access, the database name (including path), user, password and other attribute values must consist of single-byte characters that can be converted to EBCDIC. The total byte length of the database name plus attributes when converted to EBCDIC must not exceed 255 bytes. You may be able to work around this restriction for long paths or paths that include multibyte characters by setting the `derby.system.home` system property when starting Network Server and accessing the database with a relative path that is shorter and does not include multibyte characters.

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.
ssl | String | The SSL mode for the client connection. See Network encryption and authentication with SSL/TLS | ssl | The default is `off`.

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.
createDatabase | String | If set to "create", create the database specified with databaseName property. | create | This property is also available using EmbeddedDataSource. See the Derby Reference Manual for more information. Similar to setting connectionAttribute to "create=true". Only "create" is allowed, other values equate to null. The result of conflicting settings of createDatabase, shutdownDatabase and connectionAttributes is undefined.
shutdownDatabase | String | If set to "shutdown", shutdown the database specified with databaseName property. | shutdown | This property is also available using EmbeddedDataSource. See the Derby Reference Manual for more information. Similar to setting connectionAttribute to "shutdown=true". Only "shutdown" is allowed, other values equate to null. The result of conflicting settings of createDatabase, shutdownDatabase and connectionAttributes is undefined. If authentication and sqlAuthorization are both enabled, database shutdown is restricted to the database owner.

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

- Network client security
  The Derby Network Client allows you to select a security mechanism by specifying a value for the securityMechanism property.
- Network client tracing
  The Derby Network client provides a tracing facility to collect JDBC trace information and view protocol flows.
- Network client driver examples

Parent topic: Using the Network Server with preexisting Derby applications
Related concepts
The Network Server and JVMs
Accessing the Network Server by using a DataSource object
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