作者:empty 出版社:empty |
to the restrictions asset forth in subparagraph(c) (1) (ii) of the Rights in Technical Dataand Computer Software Clause as DFARS 252.227-7013 and FAR 52.227-19.Sun, Sun Microsystems, the Sun logo, Java, JavaSoft, JavaBeans, and JDBC are trade-marks or registered trademarks of Sun Microsystems, Inc.THIS PUBLICATION IS PROVIDED“AS IS”WITHOUT WARRANTY OF ANYKIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TOTHE IMPLIED WARRANTIES OF ME CHANT ABILITY, FITNESS FOR APAR-TICULAR USE.OR NON-INFRINGEMENT.THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TY-PO GRAPHICAL ERRORS.CHANGES ARE PERIODICALLY ADDED TO THEINFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED INNEW EDITIONS OF THE PUBLICATION.SUN MICROSYSTEMS, INC., MAYMAKE NEW IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANYTIME.
This document contains the final specification of the JDBC 2.0CoreAPI.The target audience for this document includes the JDBC driver vendors whose prod-ucts implement the JDBC API, other vendors who want to provide support for theJDBC API in their products, and end-users developing applications using the JDBCAPI.The initial release of the JDBC API has been well received by both end-users develop-ing database applications using Java technology, and vendors of database products.Due to its wide acceptance, the JDBC API has become a core Java API.We would liketo thank everyone who has worked on or used JDBC technology for helping to make itsuccessful.Since the first release of the JDBC API, we have received valuable feedback from themembers of the JDBC community regarding new features that would make useful ad-ditions to the API.We are continuing to solicit additional input and ideas from everyonewho has an interest in JDBC technology, and we encourage everyone to send us theirrequests and ideas for new features and directions.The JDBC 2.0API has been separated into two parts:the JDBC 2.0CoreAPI and theJDBC 2.0 Standard Extension API.Chapters 2 and 3 of this document discuss goals andgive an overview of the JDBC 2.0APIasa whole.The remainder of the document con-tains a detailed specification of the JDBC 2.0CoreAPI.A detailed specification for theJDBC 2.0 Standard Extension API is presented in a separate document.In this document we refer to the previous release of the JDBC A Plas the JDBC 1.0APLThe JDBC 2.0API design effort has been abroad industry effort that has involved overtwenty partner companies.We would like to thank the many reviewers who have con-tributed to previous versions of the specification.We especially thank Gray C loss manand Stefan Dess loch for making the initial proposal for adding SQL 3 types to the JDBC
This section outlines the main goals for the JDBC 2.0API.2.1 Leverage the strengths of the JDBC 1.0andJavaAPIsOne of the important strengths of the JDBC 1.0APIis that it is relatively easy to use.This ease-of-use is in some respects due to the Java language, which gives JDBC a“hi-level”flavor.despite the fact that it is a call-level interface.For example, users of theJDBC 1.0APIaren't required to understand low-level memory-management details.orbyte-alignment, or data alignment details when transferring data to and from the data-base.
Despite being easy to use, the JDBC API gives Java developers access to a powerful setof database capabilities.JDBC technology can be used to build sophisticated, real-world applications.The JDBC 2.0API must continue to strike the proper balance be-tween ease-of-use and providing a rich set of functionality.Existing JDBC drivers and the Java applications that use them shall continue to work—unchanged—in a Java virtual machine that supports the JDBC 2.0API.Applicationsthat don't use any of the new features of the JDBC 2.0APIdo not require any changesto continue running.It should be straightforward for existing applications to migrate tothe new JDBC APIThe Java Platform has matured since the first release of the JDBC API.Some of the newJava APIs that are important for the JDBC 2.0API are:the Java Transaction Service(JTS) .the Java Naming and Directory Interface(JNDI) , JavaBeans, Enterprise Java-Beans(EJB) , and Internationalization.The JDBC 2.0API must leverage these otherJava APIs and support them well.
The most important new Java API for JDBC is JavaBeans.When the JDBC API wasfirst released there was no component model for the Java platform.The JDBC APIshould provide a foundation for developers creating data-aware JavaBeans compo-nents.The JDBC API is a good place to provide this standard component foundationsince data access is a ubiquitous aspect of most applications.A new RowSet type hasbeen added to the JDBC Standard Extension API to meet this goal.Chapter 4 discussesthe dit ferences between the JDBC 2.0coreandJDBC 2.0 Standard Extension APIs.There are some important features provided by databases that are not supported by theJDBC 1.0API, like scrollable cursors and advanced datatypes, such as Binary LargeOBjects(BLOBS) .The JDBC 2.0API must support these advanced features.The JDBC API should provide a framework that allows developers to access instancesof user-defined datatypes that a restored in a database.The JDBC 2.0API supportsboth databases that provide storage for Java objects, and databases that store SQL 3structured types.
The JDBC API should provide some basic support for access to non-SQL tabular data,such as data stored in files.The JDBC Standard Extension API provides some limitedsupport for tabular data.See Chapter 4fora discussion of the dit ferences between theJDBC 2.0coreandJDBC 2.0 Standard Extension APIs.2.2 Maintain compatiblity with JDBC 1.0 applications and drivers2.3Keeppace with the Java platform2.4 JavaBeans2.5Adva need Database FeaturesSun Microsystems Inc.JDBC 2.0CoreAPISun Microsystems Inc.May 30.1998May 30.1998
Overview of New FeaturesThis chapter contains an overview of the new features that are being added to the JDBC2.0API.The JDBC 1.0API provided resultsets that had the ability to scroll in a forward direc-tion only.Scrollable resultsets allow for more flexibility in the processing of results byproviding both forward and backward movement through their contents.In addition,scrollable resultsets allow for relative and absolute positioning.For example, it'spos-sible to move to the four throw in a scrollable resultset directly, or to move directly tothe third row following the current row, provided the row exists.The JDBC 2.0API allows resultsets to be directly updatable, as well.The batch update feature allows an application to submit multiple update statements(insert/update/delete) in a single request to the database.This can provide a dramaticincrease in performance when a large number of update statements need to be executedIncreased support for storing persistent Java objects and a mapping for SQL 3 datatypessuch as binary large objects, and structured types, has been added to the JDBC 2.0API.An application may also customize the mapping of SQL 3 structured types into Java lan-guage classes.As its name implies, a rowset encapsulates a set of rows.A rowset mayor may notmaintain an open database connection.When a rowset is'disconnected'from its datasource, updates perfom med on the rowset are propagated to the underlying database us-ingan optimistic concurrency control algorithm.Row sets add support to the JDBC API for the JavaBeans component model.A rowsetobject is a JavaBean.A rowset implementation maybe serializable.Rowset sean becreated at design time and used in conjunction with other JavaBeans components in avisual JavaBeans builder tool to construct an application.The Java Naming and Directory Interface(JNDI) can be used in addition to the JDBCdriver manager to obtain a connection to a database.When an application uses JNDI, itspecifies a logical name that identifies a particular database instance and JDBC driverfor accessing that database.This has the advantage of making the application code in-dependent of a particular JDBC driver and JDBC URL.The JDBC 2.0API contains'hooks'that allow connection pooling to be implementedon top of the JDBC driver layer.This allows for a single connection cache that spansthe different JDBC drivers that maybe in use.Since creating and destroying databaseconnections is expensive, connection pooling is important for achieving good per for-mance, especially for server applications.Support for distributed transactions has been added as an extension to the JDBC 2.0API.This feature allows a JDBC driver to support the standard 2-phase commit proto-col used by the Java Transaction Service(JTS) .Support for character streams has been added.This means that characterdata can be re-trie ved and sent to the database as a stream of inte mation alized Unicode characters.Methods to allow java, math.BigDecimal values to be returned with full precisionhave also been added.Support for timezones has been added.3.1 Resultset enhancements3.2Batch updates3.3Adva need datatypes3.4Rowsets3.5JNDI for naming databasesSun Microsystems Inc.JDBC 2.0CoreAPI3.6 Connection Pooling3.7 Distributed transaction support3.8 Other new features