type=page
status=published
title=start-database
next=start-domain.html
prev=start-cluster.html
~~~~~~

= start-database

[[start-database-1]][[GSRFM00234]][[start-database]]

== start-database

Starts the Java DB

[[sthref2117]]

=== Synopsis

[source]
----
asadmin [asadmin-options] start-database [--help]
[--jvmoptions jvm-options]
[--dbhost host] [--dbport port-no]
[--dbhome db-file-path]
----

[[sthref2118]]

=== Description

The `start-database` subcommand starts the Java DB server that is
available for use with {productName}. Java DB is based upon Apache
Derby. Use this subcommand only for working with applications deployed
to the server.

When you start Java DB server by using the `start-database` subcommand,
the database server is started in Network Server mode. Clients
connecting to it must use the Java DB ClientDriver. For details on
connecting to the database, refer to the Apache Derby documentation.

When the database server starts, or a client connects to it
successfully, the following files are created:

* The `derby.log` file that contains the database server process log
along with its standard output and standard error information
* The database files that contain your schema (for example, database tables)

These files are created at the location that is specified by the
`--dbhome` option. To create the database files at a particular
location, you must set the `--dbhome` option. If the `--dbhome` option
is not specified, the `start-database` subcommand determines where to
create these files as follows:

* If the current working directory contains a file that is named
`derby.log`, the `start-database` subcommand creates the files in the
current working directory.
* Otherwise, the `start-database` subcommand creates the files in the
as-install``/databases`` directory.

The `start-database` subcommand starts the database process, even if it
cannot write to the log file.

This subcommand is supported in local mode only.

[[sthref2119]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--jvmoptions`::
  A space-separated list of command-line options that are passed to the
  Java application launcher when the database is started. By default, no
  options are passed. +
  The format of an option depends on whether the option has a name and a
  value or only a name:

  * If the option has a name and a value, the format is
    option-name=value.
  * If the option has only a name, the format is option-name.
    For example, `-Xmx512m`.
`--dbhost`::
  The host name or IP address of the Java DB server process. The default
  is the IP address 0.0.0.0, which denotes all network interfaces on the
  host where you run the `start-database` subcommand.
`--dbport`::
  The port number where the Java DB server listens for client
  connections. This port must be available for the listen socket,
  otherwise the database server will not start. The default is 1527.
`--dbhome`::
  The absolute path to the directory where the database files and the
  `derby.log` file are created. If the `--dbhome` option is not
  specified, the `start-database` subcommand determines where to create
  these files as follows:

  * If the current working directory contains a file that is named
  `derby.log`, the `start-database` subcommand creates the files in the
  current working directory.
  * Otherwise, the `start-database` subcommand creates the files in the
  as-install``/databases`` directory.

+
To create the database files at a particular location, you must set
  the `--dbhome` option.

[[sthref2120]]

=== Examples

[[GSRFM759]][[sthref2121]]

==== Example 1   Starting Java DB

This example starts Java DB on the host `host1` and port 5001.

[source]
----
asadmin> start-database --dbhost host1 --dbport 5001 --terse=true
Starting database in the background.  Log redirected to
/opt/SUNWappserver/databases/derby.log.
----

[[GSRFM833]][[sthref2122]]

==== Example 2   Starting Java DB With Options for the Java Application
Launcher

This example starts Java DB with the options for setting the minimum
heap memory size to 128 megabytes and the maximum heap memory size to
512 megabytes.

[source]
----
asadmin> start-database --jvmoptions="-Xms128m -Xmx512m" --terse=true
Starting database in the background.
Log redirected to /export/glassfish7/glassfish/databases/derby.log.
----

[[sthref2123]]

=== Exit Status

The exit status applies to errors in executing the `asadmin` utility.
For information on database errors, see the `derby.log` file. This file
is located in the directory you specify by using the `--dbhome` option
when you run the `start-database` subcommand. If you did not specify
`--dbhome`, the value of `DERBY_INSTALL` defaults to as-install``/javadb``.

0::
  subcommand executed successfully
1::
  error in executing the subcommand

[[sthref2124]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:stop-database.html#stop-database-1[`stop-database`(1)]

"link:administration-guide/jdbc.html#GSADG00015[Administering Database Connectivity]" in {productName} Administration Guide

For more information about the Java application launcher, see the
reference page for the operating system that you are using:

* Oracle Solaris and Linux: java - the Java application launcher
(`http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/java.html`)
* Windows: java - the Java application launcher
(`http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html`)


