Java Reference
In-Depth Information
in function escape clauses. For example,
getNumericFunctions()
returns
ABS,ACOS,ASIN,ATAN,ATAN2,CEILING,COS,COT,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,PI,RADIANS,RAND,SIGN,SIN,SQRT,TAN
for Java DB 10.8.
Notallvendorsusethesameterminologyforcatalogandschema.Forthisreason,the
String getCatalogTerm()
and
String getSchemaTerm()
methods are
presenttoreturnthevendor-specificterms,whichhappentobe
CATALOG
and
SCHEMA
for Java DB 10.8.
The
ResultSet getCatalogs()
methodreturnsaresultsetofcatalognames,
which are accessible via the result set's
TABLE_CAT
column. This result set is empty
for Java DB 10.8, which divides a single default catalog into various schemas.
The
ResultSet getSchemas()
method returns a result set of schema names,
whichareaccessibleviatheresultset's
TABLE_SCHEM
column.Thiscolumncontains
APP
,
NULLID
,
SQLJ
,
SYS
,
SYSCAT
,
SYSCS_DIAG
,
SYSCS_UTIL
,
SYSFUN
,
SYSIBM
,
SYSPROC
,and
SYSSTAT
valuesforJavaDB10.8.
APP
isthedefaultschema
in which a user's database objects are stored.
The
ResultSet getTables(String catalog, String schemaPat-
tern, String tableNamePattern, String[] types)
methodreturnsa
resultsetcontainingtablenames(inthe
TABLE_NAME
column)andothertable-oriented
metadata that match the specified
catalog
,
schemaPattern
,
tableNamePat-
tern
,and
types
.Toobtainaresultsetofalltablesforaspecificschema,pass
null
to
catalog
and
types
,theschemanameto
schemaPattern
,andthe
%
wildcard
to
tableNamePattern
.
Forexample,the
SYS
schemastores
SYSALIASES
,
SYSCHECKS
,
SYSCOLPERMS
,
SYSCOLUMNS
,
SYSCONGLOMERATES
,
SYSCONSTRAINTS
,
SYSDEPENDS
,
SYSFILES
,
SYSFOREIGNKEYS
,
SYSKEYS
,
SYSPERMS
,
SYSROLES
,
SYSROUTINEPERMS
,
SYSSCHEMAS
,
SYSSEQUENCES
,
SYSSTATEMENTS
,
SYSSTATISTICS
,
SYSTABLEPERMS
,
SYSTABLES
,
SYSTRIGGERS
, and
SYSVIEWS
tables.
Listings 9-17
and
9-18
suffer from an architectural problem. After creating the
EMPLOYEES
table, suppose that
SQLException
is thrown before the table is
dropped. The next time the
EmployeeDB
application is run,
SQLException
is
thrown when the application attempts to recreate
EMPLOYEES
because this table
alreadyexists.Youhavetomanuallydeletethe
employee
directorybeforeyoucanre-
run
EmployeeDB
.