# DataSource access example

The following example uses `org.apache.derby.jdbc.ClientDataSource` to access the Network Server:

    org.apache.derby.jdbc.ClientDataSource ds =
       new org.apache.derby.jdbc.ClientDataSource();
    ds.setDatabaseName("mydb);
    ds.setCreateDatabase("create");
    ds.setUser("user");
    ds.setPassword("mypass");

    // The host on which Network Server is running
    ds.setServerName("localhost");

    // The port on which Network Server is listening
    ds.setPortNumber(1527);

    Connection conn = ds.getConnection();

Parent topic: Accessing the Network Server by using a DataSource