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

94 lines
6.5 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="task" />
<meta name="DC.Title" content="Use JNDI for the examples" />
<meta name="abstract" content="DataSources work hand-in-hand with the Java Naming and Directory Interface (JNDI). JNDI is a Java abstraction layer for directory services just as Java Database Connectivity (JDBC) is an abstraction layer for databases." />
<meta name="description" content="DataSources work hand-in-hand with the Java Naming and Directory Interface (JNDI). JNDI is a Java abstraction layer for directory services just as Java Database Connectivity (JDBC) is an abstraction layer for databases." />
<meta name="DC.Relation" scheme="URI" content="jdbcgets.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbctydr.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbcreqs.htm" />
<meta name="DC.Relation" scheme="URI" content="jdbctutr.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="dasrjndi" />
<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>Use JNDI for the examples</title>
</head>
<body id="dasrjndi"><a name="dasrjndi"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use JNDI for the examples</h1>
<div><p>DataSources work hand-in-hand with the Java™ Naming and Directory Interface (JNDI).
JNDI is a Java abstraction layer for directory services just as Java Database
Connectivity (JDBC) is an abstraction layer for databases.</p>
<div class="section"><p> JNDI is used most often with the Lightweight Directory Access
Protocol (LDAP), but it may also be used with the CORBA Object Services (COS),
the Java Remote
Method Invocation (RMI) registry, or the underlying file system. This varied
use is accomplished by means of the various directory service providers that
turn common JNDI requests into specific directory service requests. Java 2
SDK, v 1.3 includes three service providers: the LDAP service provider, the
COS naming service provider, and the RMI registry service provider.</p>
<div class="note"><span class="notetitle">Note:</span> Keep
in mind that using RMI can be a complex undertaking. Before you choose RMI
as a solution, be sure that you understand the ramifications of doing so.
A good place to begin assessing RMI is <a href="javaapi/guide/rmi/index.html" target="_blank">Java Remote Method Invocation (RMI)</a>.</div>
<p>The
DataSource samples were designed using the JNDI file system service provider.
If you want to run the examples provided, there must be a JNDI service provider
in place.</p>
<p>Follow these directions to set up the environment for the
file system service provider:</p>
</div>
<ol><li><span>Download the file system JNDI support from Sun Microsystems <a href="http://java.sun.com/products/jndi" target="_blank">JNDI
site</a>.</span></li>
<li><span>Transfer (using FTP or another mechanism) fscontext.jar and providerutil.jar
to your system and put them in /QIBM/UserData/Java400/ext. This is the extensions
directory and the JAR files that you place here are found automatically when
you run your application (that is, you do not need them in your classpath).</span></li>
</ol>
<div class="section"><p>Once you have support for a service provider for JNDI, you must
set up the context information for your applications. This can be accomplished
by putting the required information in a SystemDefault.properties file. There
are several places on the system where you can specify default properties,
but the best way is to create a text file called SystemDefault.properties
in your home directory (that is, at /home/).</p>
<p>To create a file, use the
following lines or add them to your existing file:</p>
<pre># Needed env settings for JNDI.
java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url=file:/DataSources/jdbc</pre>
<p> These lines
specify that the file system service provider handles JNDI requests and that
/DataSources/jdbc is the root for tasks that use JNDI. You can change this
location, but the directory that you specify must exist. The location that
you specify is where the example DataSources are bound and deployed. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="jdbcgets.htm" title="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.">Get started with JDBC</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="jdbctydr.htm" title="This topic defines the Java Database Connectivity (JDBC) driver types. Driver types are used to categorize the technology used to connect to the database. A JDBC driver vendor uses these types to describe how their product operates. Some JDBC driver types are better suited for some applications than others.">Types of JDBC drivers</a></div>
<div><a href="jdbcreqs.htm" title="Before you write and deploy your JDBC applications, you may need to include specific jar files in your classpath.">JDBC requirements</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="jdbctutr.htm" title="The following is a tutorial on writing a Java Database Connectivity (JDBC) program and having it run on the an iSeries server with the native JDBC driver. It is designed to show you the basic steps required for your program to run JDBC.">JDBC tutorial</a></div>
</div>
</div>
</body>
</html>