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

99 lines
7.2 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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="Connections" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta name="DC.Relation" scheme="URI" content="jdbc.htm" />
<meta name="DC.Relation" scheme="URI" content="db2drivr.htm" />
<meta name="DC.Relation" scheme="URI" content="conprop.htm" />
<meta name="DC.Relation" scheme="URI" content="udbdatsr.htm" />
<meta name="DC.Relation" scheme="URI" content="dasrprop.htm" />
<meta name="DC.Relation" scheme="URI" content="otherdts.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="connects" />
<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>Connections</title>
</head>
<body id="connects"><a name="connects"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Connections</h1>
<div><p>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.</p>
<p>Obtaining a connection in JDBC can be accomplished in two ways:</p>
<ul><li>Through the DriverManager class.</li>
<li>By using DataSources.</li>
</ul>
<p> Using DataSources to obtain a connection is preferred because it enhances
application portability and maintainability. It also allows an application
to transparently use connection and statement pooling, and distributed transactions.
</p>
<p>For details on obtaining connections, see the following sections:</p>
<blockquote> <p><strong><a href="db2drivr.htm">DriverManager</a></strong> The DriverManager
is a static class that manages the set of available JDBC drivers for an application
to use.</p>
<p><strong><a href="conprop.htm">Connection properties</a></strong>
The table lists valid JDBC driver connection properties, their values, and
their descriptions.</p>
<p><strong><a href="udbdatsr.htm">Use DataSources
with UDBDataSource</a></strong> You can deploy a DataSource with the UDBDataSource
class by setting it up to have specific properties and then binding it into
some directory service through the use of the Java Naming and Directory Interface (JNDI).</p>
<p><strong><a href="dasrprop.htm">DataSource properties</a></strong> The table lists valid
DataSource properties, their values, and their descriptions.</p>
<p><strong><a href="otherdts.htm">Other DataSource implementations</a></strong> There are
other implementations of the DataSource interface provided with the native
JDBC driver. They exist only to serve as a bridge until the UDBDataSource
and its related functions are adopted.</p>
</blockquote>
<p>Once a connection is obtained, it can be used to accomplish the following
JDBC tasks:</p>
<ul><li><a href="statemnt.htm">Create various types of Statement objects</a> for
interacting with the database.</li>
<li>Control <a href="transactions.htm">transactions</a> against the
database.</li>
<li><a href="datameta.htm">Retrieve metadata</a> about the database.</li>
</ul>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="db2drivr.htm">DriverManager</a></strong><br />
DriverManager is a static class in the Java 2 Software Development Kit (J2SDK).
DriverManager manages the set of Java Database Connectivity (JDBC) drivers
that are available for an application to use. </li>
<li class="ulchildlink"><strong><a href="conprop.htm">Connection properties</a></strong><br />
This table contains valid JDBC driver connection properties, their values, and their descriptions.</li>
<li class="ulchildlink"><strong><a href="udbdatsr.htm">Use DataSources with UDBDataSource</a></strong><br />
DataSource interfaces were designed to allow additional flexibility
in using Java Database Connectivity (JDBC) drivers.</li>
<li class="ulchildlink"><strong><a href="dasrprop.htm">DataSource properties</a></strong><br />
This table contains valid data source properties, their values, and their descriptions.</li>
<li class="ulchildlink"><strong><a href="otherdts.htm">Other DataSource implementations</a></strong><br />
There are two implementations of the DataSource interface that are included with the native JDBC driver. These DataSource implementations should be considered deprecated. While you can still use them, they are not enhanced with future improvements; for example, robust connection and statement pooling are not added to these implementations. These implementations exist until you adopt the UDBDataSource interface and its related functions.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="jdbc.htm" title="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.">Access your iSeries database with the IBM Developer Kit for Java JDBC driver</a></div>
</div>
</div>
</body>
</html>