background image
<< create=true attribute | databaseName=nameofDatabase attribute >>

createFrom=path attribute

<< create=true attribute | databaseName=nameofDatabase attribute >>
Derby Reference Manual
335
connection fails to be created, check for the database directory. If it exists, remove it and
its contents before the next attempt to create the database.
Database owner
When the database is created, the current authorization identifier becomes the database
owner (see the
user=userName attribute
). If authentication and SQL authorization
are both enabled (see "Enabling user authentication" and "Setting the SQL standard
authorization mode" in the Derby Developer's Guide), only the database owner can
shut
down
or
drop
the database,
encrypt
it, reencrypt it with a new
boot password
or new
encryption key
, or perform a full upgrade. If authentication is not enabled, and no user
is supplied, the database owner defaults to "APP", which is also the name of the default
schema (see
SET SCHEMA statement
).
Combining with other attributes
You must specify a databaseName (after the subprotocol or subsubprotocol in the
database connection URL) or a
databaseName=nameofDatabase
attribute with this
attribute.
You can combine this attribute with other attributes. To specify a territory when creating a
database, use the
territory=ll_CC
attribute.
Examples
Creating a file system database:
-- create a file system database
jdbc:derby:sampleDB;create=true
-- create a file system database using the databaseName attribute
jdbc:derby:;databaseName=newDB;create=true
-- create an in-memory database using the embedded driver
jdbc:derby:memory:myInMemDB;create=true
-- create an in-memory database using the databaseName attribute
jdbc:derby:;databaseName=memory:myInMemDB;create=true
-- create an in-memory database using the Network Server
jdbc:derby://localhost:1527/memory:myInMemDB;create=true
See "Using in-memory databases" in the Derby Developer's Guide for information on
creating in-memory databases.
createFrom=path attribute
Function
You can specify the createFrom=path attribute in the boot time connection URL to create
a database using a full backup at a specified location. If there is a database with the
same name in derby.system.home, an error will occur and the existing database will
be left intact. If there is not an existing database with the same name in the current
derby.system.home location, the whole database is copied from the backup location to
the derby.system.home location and started.
The Log files are copied to the default location. The logDevice attribute can be
used in conjunction with createFrom=path to store logs in a different location. With
createFrom=path you do not need to copy the individual log files to the log directory.
For more information about using this attribute, see "Creating a database from a backup
copy" in the Derby Server and Administration Guide.
Combining with other attributes
Do not combine this attribute with rollForwardRecoveryFrom, restoreFrom, or create.
Example