Whole document tree
10 Other New Features and ChangesThis chapter describes additional changes that have been made in the JDBC API.10.1 Changes to java.sql.ResultSetA version of theResultSet.getBigDecimal() method that returns full precision has
been added.
10.2 Changes to java.sql.ResultSetMetaDataTheResultSetMetaData.getColumnType() method may now return the new SQL
type codes: STRUCT , DISTINCT , BLOB , etc. The STRUCT and DISTINCT type codes are always
returned for structured and distinct values, independent of whether the default or
a custom type mapping is being used.
The
A
The 10.3 Changes to DatabaseMetaDataTheDatabaseMetaData.getColumns() method may now return DATA_TYPE values
of the new SQL99 types: BLOB, CLOB, etc. The DatabaseMetaData.getColumns()
method returns the same type names as those listed in Section 10.2 for the
SQL99 data types.
Added method
Added method
Added methods to support the new 10.4 Changes to java.sql.DriverManagerADriverManager.setLogWriter() method that takes a java.io.PrintWriter object
as input has been added. A new DriverManager.getLogWriter() method returns
a PrintWriter object. The set/getLogStream() methods have been deprecated.
10.5 Date, Time, and TimestampThe JDBC API follows the Java platform's approach of representing dates and times as a millisecond value relative to January 1, 1970 00:00:00 GMT. Since most databases don't support the notion of a time zone, the JDBC 2.1 core API adds new methods to allow a JDBC driver to get/setDate , Time , and Timestamp values for a particular time
zone using a Calendar . For example,
returns aResultSet rs; ... Date date1 = rs.getDate(1); Date object that wraps a millisecond value which denotes a particular date,
like January 3, 1999, and a normalized time 00:00:00 in the default time zone. The time
component of the Date is set to zero in the default time zone since SQL DATE values
don't have a time component. Since a Calendar was not supplied explicitly to getDate()
, the default time zone (really the default Calendar ) is used by the JDBC driver
internally to create the appropriate millisecond value assuming that the underlying database
doesn't store time zone information.
The following example retrieves a date value in GMT-Greenwich Mean Time.
ResultSet rs; ... TimeZone.setDefault(TimeZone.getTimeZone("GMT")); Calendar cal = Calendar.getInstance(); Date date2 = rs.getDate(1, cal);
In the example above, a
Note that the two
if (date1.equals(date2)) //never get here
This is because each Java language
An application should create a 10.6 Refinement to the Drop Table requirementThe JDBC 1.0 API specification required that JDBC 1.0 compliant drivers provide full support for the SQL92, Transitional Level, DROP TABLE command, including full support for the CASCADE and RESTRICT options of DROP TABLE. Because some popular databases currently do not fully support DROP TABLE as it is defined in the SQL92 specification, this requirement has been relaxed in the JDBC API specification.A JDBC compliant driver is required to support the DROP TABLE command as specified by SQL92, Transitional Level. However, support for the CASCADE and RESTRICT options of DROP TABLE is optional for a JDBC compliant driver. In addition, the behavior of DROP TABLE is implementation defined when there are views or integrity constraints defined that reference a table that is being dropped.
Contents | Prev | Next jdbc@eng.sun.com or jdbc-business@eng.sun.com Copyright © 1996-1999 Sun Microsystems, Inc. All rights reserved. |