Java Reference
In-Depth Information
tem.out.println(rsSchem.getString("TABLE_SCHEM"));
System.out.println();
System.out.println("Schema/Table");
System.out.println("------------");
rsSchem = dbmd.getSchemas();
while (rsSchem.next())
{
String schem = rsSchem.getString("TABLE_SCHEM");
ResultSet rsTab = dbmd.getTables(null, schem, "%",
null);
while (rsTab.next())
System.out.println(schem+"
"+r-
sTab.getString("TABLE_NAME"));
}
}
}
Listing 9-19 ' s dump() method invokes various methods on its dbmd argument to
output assorted metadata.
The int getDatabaseMajorVersion() and int getData-
baseMinorVersion() methodsreturnthemajor(e.g.,10)andminor(e.g.,8)parts
ofJavaDB'sversionnumber.Similarly, String getDatabaseProductName()
returns the name of this product (e.g., Apache Derby), and String getDriver-
Name() returns the name of the driver (e.g., Apache Derby Embedded JDBC Driver).
SQL defines various functions that can be invoked as part of SELECT and other
statements. For example, you can specify SELECT COUNT(*) AS TOTAL FROM
EMPLOYEES to return a one-row-by-one-column result set with the column named
TOTAL and the row value containing the number of rows in the EMPLOYEES table.
BecausenotallRDMSesadoptthesamesyntaxforspecifyingfunctioncalls,JDBC
uses a function escape clause , consisting of { fn functionname ( arguments )
} ,toabstractoverdifferences.Forexample, SELECT {fn UCASE(NAME)} FROM
EMPLOYEES selects all NAME column values from EMPLOYEES and uppercases their
values in the result set.
The String getNumericFunctions() , String getStringFunc-
tions() , String getSystemFunctions() , and String
getTimeDateFunctions() methodsreturnlistsoffunctionnamesthatcanappear
Search WWH ::




Custom Search