📄 _chapter 4.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Chapter 4</title>
<link rel="stylesheet" type="text/css" href="docsafari.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<ul></ul>
<table width="100%" border="1" bgcolor="#EBEBFF">
<tr>
<td width="5%" align="left" valign="middle"><a href="_chapter%203.htm"><img src="Larrow.gif" width="17" height="19" border="0"></a></td>
<td align="center" valign="middle"><a class="docLink" href="Front%20matter.htm">CONTENTS</a></td>
<td width="5%" align="right" valign="middle"><a href="_chapter%205.htm"><img src="Rarrow.gif" width="17" height="19" border="0"></a></td>
</tr>
</table>
<h2 class="docChapterTitle">Chapter 4. Database Connectivity: JDBC</h2>
<ul>
<li>
<p class="docList"><a class="docLink" href="#c4s1">The Design of JDBC</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s2">The Structured Query Language</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s3">Installing JDBC</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s4">Basic JDBC Programming Concepts</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s5">Executing Queries</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s6">Scrollable and Updatable Result Sets</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s7">Metadata</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s8">Transactions</a></li>
<li>
<p class="docList"><a class="docLink" href="#c4s9">Advanced Connection Management</a></li>
</ul>
<p class="docText">In the summer of 1996, Sun released the first version of the
Java Database Connectivity (JDBC) kit. This package lets programmers connect to
a database, query it, or update it, using the Structured Query Language or SQL.
(SQL, usually pronounced like "sequel," is an industry standard for database
access.) When JDBC was first announced, we considered this one of the most
important developments in programming for the Java platform. It is not just that
databases are among the most common use of hardware and software today. After
all, there are a lot of products running after this market, so why did we think
the Java programming language had the potential to make a big splash? The reason
that Java and JDBC have an essential advantage over other database programming
environments is this:</p>
<ul>
<li>
<p class="docList">Programs developed with the Java programming language and
JDBC are platform independent and vendor independent.</li>
</ul>
<p class="docText">The same database program written in the Java programming
language can run on an NT box, a Solaris server, or a database appliance powered
by the Java platform. You can move your data from one database to another, for
example, from Microsoft SQL Server to Oracle, or even to a tiny database
embedded in a device, and the same program can still read your data. This is in
sharp contrast to traditional database programming. It is all too common that
one writes database applications in a proprietary database language, using a
database management system that is available only from a single vendor. The
result is that you can run the resulting application only on one or two
platforms. We believe that <span class="docEmphasis">because of their
universality,</span> the Java programming language and JDBC will eventually
replace proprietary database languages and call level interfaces used by vendors
such as Oracle, Informix, and Microsoft for accessing databases.</p>
<div class="docNote">
<p class="docNoteTitle">NOTE</p>
<table cellSpacing="0" cellPadding="1" width="90%" border="0">
<tr>
<td vAlign="top" width="60">
<img alt="graphics/note.gif" src="note.gif" align="left" border="0" width="54" height="53"><br>
</td>
<td vAlign="top">
<p class="docText">Some database vendors now build a Java Virtual Machine
into the database itself so that you can write stored procedures in Java.
This technology is part of the SQLJ specification. For more information on
SQLJ, see <a class="docLink" href="http://www.sqlj.org" target="_blank">
http://www.sqlj.org</a>.</td>
</tr>
</table>
</div>
<p class="docText">As part of the release of Java 2 in 1998, a second version of
JDBC was issued as well. At the time of this writing, support for JDBC 2 is
still not universal, but many JDBC 2 drivers are available. JDBC 2 introduces
several major features such as scrollable cursors and support for advanced SQL
types. The JDBC 3 specification was in its final review phase as this chapter
was finished. JDBC 3 enhancements are more technical in nature. In this chapter,
we alert you when you need to be aware of the version differences.</p>
<p class="docText">We still must caution you that the JDK offers no tools for
database programming with the Java programming language. For form designers,
query builders, and report generators, you need to turn to third-party packages.
"Corporate" or "professional" versions of development environments for the Java
platform, such as Visual Caf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -