Java EE 6 SDK

# Using Java DB with Sample applications

The Java EE SDK includes the Java DB database server. This document describes how to start and stop the Java DB database server, create and delete databases using SQL scripts, create and delete JDBC connection pools, create and delete JDBC resources.

Properties for the database are defined in the file bp-project/app-server.properties. The `db.home` property specifies where Java DB creates new databases. Make sure that this property specifies a directory for which you have write permission.

Generally, each sample application has a `setup` sub-directory used to define the JDBC resources (and any other resources) needed for the project. The build.xml file in this directory defines Ant targets for manipulating the database. Usually, you must create and populate the database and configure corresponding JDBC resources before running the application.

Common Database Operations
Operation | Ant command (target)
--- | ---
Start database server | ant start-db
Stop database server | ant stop-db
Create database using create sql script | ant create-db
Delete database using delete sql script | ant delete-db
Create JDBC connection pool | ant create-jdbc-connection-pool
Delete JDBC connection pool | ant delete-jdbc-connection-pool
Create JDBC resource | ant create-jdbc-resource
Delete JDBC resource | ant delete-jdbc-resource
Create database, create JDBC connection pool and create JDBC resource | ant setup
Delete database, delete JDBC connection pool and delete JDBC resource | ant unsetup

Copyright © 1997-2010 Oracle and/or its affiliates. All rights reserved.