Java Reference
In-Depth Information
}
@Override
public
public
void
void
displayTable
(
String table
,
ResultSet rs
)
throws
throws
IOException
,
SQLException
{
write
(
rs
);
}
/** Return a printable name for this decorator
* @see ResultsDecorator#getName()
*/
public
public
String
getName
() {
return
return
"HTML"
;
}
}
DatabaseMetaData
database product and uses a helper method in my
ConnectionUtil
class to format the de-
fault transaction isolation (basically, the extent to which users of a database can interfere
with each other; see any good book on databases for information on transactions and why it's
often really important to know your database's default transaction isolation).
Example 18-11. DatabaseMetaDemo.java
/** A database MetaData query */
public
public class
class
DatabaseMetaDemo
DatabaseMetaDemo
{
public
public static
static
void
void
main
(
String
[]
args
) {
try
try
{
// Get the connection
Connection conn
=
ConnectionUtil
.
getConnection
(
args
[
0
]);
// Get a Database MetaData as a way of interrogating
// the names of the tables in this database.
DatabaseMetaData meta
=
conn
.
getMetaData
();
System
.
out
.
println
(
"We are using "
+
meta
.
getDatabaseProductName
());
System
.
out
.
println
(
"Version is "
+
meta
.
getDatabaseProductVersion
() );
int
int
txisolation
=
meta
.
getDefaultTransactionIsolation
();
System
.
out
.
println
(
"Database default transaction isolation is "
+
txisolation
+
" ("
+