ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/jdbc.htm

207 lines
16 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Access your iSeries database with the IBM Developer Kit for Java JDBC driver" />
<meta name="abstract" content="The IBM Developer Kit for Java JDBC driver, also known as the &#34;native&#34; driver, provides programmatic access to iSeries database files. Using the Java Database Connectivity (JDBC) API, applications written in the Java language can access JDBC database functions with embedded Structured Query Language (SQL), run SQL statements, retrieve results, and propagate changes back to the database. The JDBC API can also be used to interact with multiple data sources in a distributed, heterogeneous environment." />
<meta name="description" content="The IBM Developer Kit for Java JDBC driver, also known as the &#34;native&#34; driver, provides programmatic access to iSeries database files. Using the Java Database Connectivity (JDBC) API, applications written in the Java language can access JDBC database functions with embedded Structured Query Language (SQL), run SQL statements, retrieve results, and propagate changes back to the database. The JDBC API can also be used to interact with multiple data sources in a distributed, heterogeneous environment." />
<meta name="DC.Relation" scheme="URI" content="dbconn.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbcgets.htm" />
<meta name="DC.Relation" scheme="URI" content="connects.htm" />
<meta name="DC.Relation" scheme="URI" content="rzahajvmprops.htm" />
<meta name="DC.Relation" scheme="URI" content="datameta.htm" />
<meta name="DC.Relation" scheme="URI" content="exceptin.htm" />
<meta name="DC.Relation" scheme="URI" content="transactions.htm" />
<meta name="DC.Relation" scheme="URI" content="distrans.htm" />
<meta name="DC.Relation" scheme="URI" content="statetyp.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltsets.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbcpool.htm" />
<meta name="DC.Relation" scheme="URI" content="batchupd.htm" />
<meta name="DC.Relation" scheme="URI" content="advancdt.htm" />
<meta name="DC.Relation" scheme="URI" content="rowsetty.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbcperf.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="jdbc" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Access your iSeries database with the IBM Developer Kit for Java JDBC
driver</title>
</head>
<body id="jdbc"><a name="jdbc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Access your iSeries database with the IBM Developer Kit for Java JDBC
driver</h1>
<div><p>The IBM<sup>®</sup> Developer
Kit for Java™ JDBC driver, also known as the "native" driver,
provides programmatic access to iSeries™ database files. Using the Java Database
Connectivity (JDBC) API, applications written in the Java language
can access JDBC database functions with embedded Structured Query Language
(SQL), run SQL statements, retrieve results, and propagate changes back to
the database. The JDBC API can also be used to interact with multiple data
sources in a distributed, heterogeneous environment.</p>
<p>The SQL99 Command Language Interface (CLI), on which the JDBC API is based,
is the basis for ODBC. JDBC provides a natural and easy-to-use mapping from
the Java programming
language to the abstractions and concepts defined in the SQL standard.</p>
<p>To use the JDBC driver, see the following:</p>
<blockquote> <p><strong><a href="jdbcgets.htm">Get started with JDBC</a></strong> You
can follow the tutorial of writing a JDBC program and running it on your iSeries server. </p>
<p><strong><a href="connects.htm">Connections</a></strong> An application program can have
multiple connections at one time. You can represent a connection to a data
source in JDBC by using a Connection object. It is through Connection objects
that Statement objects are created for processing SQL statements against the
database.</p>
<p><strong><a href="rzahajvmprops.htm">JVM properties</a></strong>
Some settings used by the native JDBC driver cannot be set using a connection
property. These settings must be set for the JVM in which the native JDBC
driver is running.</p>
<p><strong><a href="datameta.htm">DatabaseMetaData</a></strong>
The DatabaseMetaData interface is used by application servers and tools to
determine how to interact with a given data source. Applications may also
use DatabaseMetaData methods to obtain information about a specific data source.</p>
<p><strong><a href="exceptin.htm">Exceptions</a></strong> The Java language uses exceptions to provide
error-handling capabilities for its programs. An exception is an event that
occurs when you run your program that disrupts the normal flow of instructions.</p>
<p><strong><a href="transactions.htm">Transactions</a></strong> A transaction is a logical
unit of work. Transactions are used to provide data integrity, correct application
semantics, and a consistent view of data during concurrent access. All JDBC-compliant
drivers must support transactions. </p>
<p><strong><a href="statetyp.htm">Statement
types</a></strong> The Statement interface and its PreparedStatement and CallableStatement
subclasses are used to process SQL commands against the database. SQL statements
cause the generation of ResultSet objects.</p>
<p><strong><a href="rsltsets.htm">ResultSets</a></strong>
The ResultSet interface provides access to the results generated by running
queries. Data of a ResultSet can be thought of as a table with a specific
number of columns and a specific number of rows. By default, the table rows
are retrieved in sequence. Within a row, column values can be accessed in
any order.</p>
<p><strong><a href="jdbcpool.htm">JDBC object pooling</a></strong>
Since many objects used in JDBC are expensive to create such as Connection,
Statement, and ResultSet objects, significant performance benefits can be
achieved by using JDBC object pooling. With object pooling, you can reuse
these objects instead of creating them every time you need them.</p>
<p><strong><a href="batchupd.htm">Batch updates</a></strong> Batch update support allows
many updates to the database to be passed as a single transaction between
the user program and the database. Batch updates can significantly improve
performance when many updates must be performed at once. </p>
<p><strong><a href="advancdt.htm">Advanced data types</a></strong> There are several new
data types called SQL3 data types that are provided in the iSeries database.
The SQL3 data types give you a tremendous amount of flexibility. They are
ideal for storing serialized Java objects, Extensible Markup Language
(XML) documents, and multimedia data such as songs, product pictures, employee
photographs, and movie clips. The SQL3 data types include the following:</p>
<ul><li>Distinct types</li>
<li>Large objects such as Binary Large Objects, Character Large Objects, and
Double Byte Character Large Objects</li>
<li>Datalinks</li>
</ul>
<p><strong><a href="rowsetty.htm">RowSets</a></strong> The RowSet specification
is designed to be more of a framework than an actual implementation. The RowSet
interfaces define a set of core functionality that all RowSets have.</p>
<p><strong><a href="distrans.htm">Distributed transactions</a></strong> The Java Transaction
API (JTA) has support for complex transactions. It also provides support for
decoupling transactions from Connection objects. JTA and JDBC work together
to decouple transactions from Connection objects and allows you to have a
single connection work on multiple transactions concurrently. Conversely,
it allows you to have multiple connections work on a single transaction.</p>
<p><strong><a href="jdbcperf.htm">Performance tips</a></strong> You can obtain the best
possible performance from your JDBC applications with these performance tips.</p>
</blockquote>
<p>For more information about JDBC, see the <a href="http://www.java.sun.com/products/jdbc" target="_blank">JDBC</a> documentation by Sun Microsystems, Inc.</p>
<p>For more information about iSeries native JDBC driver, see <a href="http://www-1.ibm.com/servers/enable/site/java/jdbc/jdbcfaq.html" target="_blank">iSeries native
JDBC Driver FAQS </a>.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="jdbcgets.htm">Get started with JDBC</a></strong><br />
The Java Database Connectivity (JDBC) driver shipped with
the Developer Kit for Java is called the Developer Kit for Java JDBC
driver. This driver is also commonly known as the native JDBC driver.</li>
<li class="ulchildlink"><strong><a href="connects.htm">Connections</a></strong><br />
The Connection object represents a connection to a data source
in Java Database
Connectivity (JDBC). It is through Connection objects that Statement objects
are created for processing SQL statements against the database. An application
program can have multiple connections at one time. These Connection objects
can all connect to the same database or connect to different databases.</li>
<li class="ulchildlink"><strong><a href="rzahajvmprops.htm">JVM Properties for JDBC</a></strong><br />
Some settings used by the native JDBC driver cannot be set using a connection property. These settings must be set for the JVM in which the native JDBC driver is running. These settings are used for all connections created by the native JDBC driver.</li>
<li class="ulchildlink"><strong><a href="datameta.htm">DatabaseMetaData interface for IBM Developer Kit for Java</a></strong><br />
The DatabaseMetaData interface is implemented by the IBM Developer
Kit for Java JDBC driver to provide information about its underlying
data sources. It is used primarily by application servers and tools to determine
how to interact with a given data source. Applications may also use DatabaseMetaData
methods to obtain information about a data source, but this is less typical.</li>
<li class="ulchildlink"><strong><a href="exceptin.htm">Exceptions</a></strong><br />
The Java language uses exceptions to provide error-handling
capabilities for its programs. An exception is an event that occurs when you
run your program that disrupts the normal flow of instructions.</li>
<li class="ulchildlink"><strong><a href="transactions.htm">Transactions</a></strong><br />
A transaction is a logical unit of work. To complete a logical unit of work, several actions may have to be taken against a database.</li>
<li class="ulchildlink"><strong><a href="distrans.htm">Distributed transactions</a></strong><br />
Typically, transactions in Java Database Connectivity (JDBC) are local.
This means that a single connection performs all the work of the transaction
and that the connection can only work on one transaction at a time. When all
the work for that transaction has been completed or has failed, commit or
rollback is called to make the work permanent, and a new transaction can begin.
There is, however, also advanced support for transactions available in Java that
provides functionality beyond local transactions. This support is fully specified
by the Java Transaction API.</li>
<li class="ulchildlink"><strong><a href="statetyp.htm">Statement types</a></strong><br />
The Statement interface and its PreparedStatement and CallableStatement subclasses are used to process structured query language (SQL) commands against the database. SQL statements cause the generation of ResultSet objects.</li>
<li class="ulchildlink"><strong><a href="rsltsets.htm">ResultSets</a></strong><br />
The ResultSet interface provides access to the results generated by running queries. Conceptually, data of a ResultSet can be thought of as a table with a specific number of columns and a specific number of rows. By default, the table rows are retrieved in sequence. Within a row, column values can be accessed in any order.</li>
<li class="ulchildlink"><strong><a href="jdbcpool.htm">JDBC object pooling</a></strong><br />
Object pooling is the most common topic to come up when discussing Java Database
Connectivity (JDBC) and performance. Since many objects used in JDBC are expensive
to create such as Connection, Statement, and ResultSet objects, significant
performance benefits can be achieved by reusing these objects instead of creating
every time you need them.</li>
<li class="ulchildlink"><strong><a href="batchupd.htm">Batch updates</a></strong><br />
Batch update support allows any updates to the database to be passed as a single transaction between the user program and the database. This procedure can significantly improve performance when many updates must be performed at once.</li>
<li class="ulchildlink"><strong><a href="advancdt.htm">Advanced data types</a></strong><br />
Advanced SQL3 data types give you a tremendous amount of flexibility.
They are ideal for storing serialized Java objects, Extensible Markup Language
(XML) documents, and multimedia data such as songs, product pictures, employee
photographs, and movie clips. Java Database Connectivity (JDBC) 2.0 and
higher provide support for working with these data types that are a part of
the SQL99 standard.</li>
<li class="ulchildlink"><strong><a href="rowsetty.htm">RowSets</a></strong><br />
RowSets were originally added to the Java Database Connectivity (JDBC) 2.0 Optional
Package. Unlike some of the better-known interfaces of the JDBC specification,
the RowSet specification is designed to be more of a framework than an actual
implementation. The RowSet interfaces define a set of core functionality that
all RowSets have. RowSet implementation providers have considerable freedom
to define the functionality that is needed to fit their needs in a specific
problem space.</li>
<li class="ulchildlink"><strong><a href="jdbcperf.htm">Performance tips for the IBM Developer Kit for Java JDBC driver</a></strong><br />
The IBM Developer
Kit for Java JDBC driver is designed to be a high performance Java interface
for working with the database. However, getting the best possible performance
requires that you build your applications in a way that takes advantage of
the strengths the JDBC driver has to offer. The following tips are considered
good JDBC programming practice. Most are not specific to the native JDBC driver.
Therefore, applications written according to these guidelines also perform
well if used with JDBC drivers other than the native JDBC driver.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dbconn.htm" title="With the IBM Developer Kit for Java, your Java programs can access your database files in three ways.">Database access with the IBM Developer Kit for Java</a></div>
</div>
</div>
</body>
</html>