Java Reference
In-Depth Information
After
run 'create_emp_schema.sql'
finishes, the specified
EMPLOYEES
table is added to the newly created
employees
database. To verify the table's exist-
ence,run
dblook
againstthe
employees
directory,asthefollowingsessiondemon-
strates.
C:\db>dblook -d jdbc:derby:employees
-- Timestamp: 2011-09-19 22:17:20.375
-- Source database is: employees
-- Connection URL is: jdbc:derby:employees
-- appendLogs: false
-- ----------------------------------------------
-- DDL Statements for tables
-- ----------------------------------------------
CREATE TABLE "APP"."EMPLOYEES" ("NAME" VARCHAR(30), "PHOTO"
BLOB(2147483647));
C:\db>
Alldatabaseobjects(e.g.,tablesandindexes)areassignedtouserandsystemschem-
as, which logically organize these objects in the same way that packages logically or-
ganizeclasses.Whenausercreatesoraccessesadatabase,JavaDBusesthespecified
usernameasthenamespacenamefornewlyaddeddatabaseobjects.Intheabsenceofa
username, Java DB chooses
APP
, as the preceding session output shows.
JDBC
JDBC
is an API (associated with the
java.sql
,
javax.sql
,
javax.sql.rowset
,
javax.sql.rowset.serial
, and
javax.sql.rowset.spi
packages—Imainlyfocuson
java.sql
inthischapter)
for communicating with RDBMSes in an RDBMS-independent manner. You can use
JDBCtoperformvariousdatabaseoperations,suchassubmittingSQLstatementsthat
telltheRDBMStocreatearelationaldatabaseortable,andtoupdateorquerytabular
data.