ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/jdbcdatasourcepane.htm

91 lines
4.4 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="reference" />
<meta name="DC.Title" content="AS400 JDBCDataSourcePane" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<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="jdbcdatasourcepane" />
<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>AS400 JDBCDataSourcePane</title>
</head>
<body id="jdbcdatasourcepane"><a name="jdbcdatasourcepane"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">AS400 JDBCDataSourcePane</h1>
<div><p></p>
<div class="section"><p>The <a href="javadoc/com/ibm/as400/vaccess/AS400JDBCDataSourcePane.html"> AS400JDBCDataSourcePane</a> class presents
the property values of an AS400JDBCDataSource object. Optionally, changes
can be made to the AS400JDBCDataSource object.</p>
<p>AS400JDBCDataSourcePane
extends JComponent. To use an AS400JDBCDataSourcePane to display the properties
of a data source, the data source can either be specified on the AS400JDBCDataSourcePane
constructor or set after the AS400JDBCDataSourcePane has been created using
setDataSource(). Changes made to the graphical user interface (GUI) can be
applied to the data source object using applyChanges().</p>
</div>
<div class="section" id="jdbcdatasourcepane__jdbcdspexample"><a name="jdbcdatasourcepane__jdbcdspexample"><!-- --></a><h4 class="sectiontitle">Example: Using AS400JDBCDataSourcePane</h4><p>The
following example creates an AS400JDBCDataSourcePane and an <span class="uicontrol">OK</span> button
and adds them to a frame. Changes made to the GUI are applied to the data
source when you click <span class="uicontrol">OK</span>.</p>
<pre> // Create a data source.
myDataSource = new AS400JDBCDataSource();
// Create a window to hold the pane and an OK button.
JFrame frame = new JFrame ("JDBC Data Source Properties");
// Create a data source pane.
dataSourcePane = new AS400JDBCDataSourcePane(myDataSource);
// Create an OK button
JButton okButton = new JButton("OK");
// Add an ActionListener to the OK button. When OK is
// pressed, applyChanges() will be called to commit any
// changes to the data source.
okButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
// Apply all changes made on the data source pane
// to the data source. If all changes are applied
// successfully, get the data source from the pane.
if (dataSourcePane.applyChanges())
{
System.out.println("ok pressed");
myDataSource = dataSourcePane.getDataSource();
System.out.println(myDataSource.getServerName());
}
}
}
);
// Setup the frame to show the pane and OK button.
frame.getContentPane ().setLayout (new BorderLayout ());
frame.getContentPane ().add ("Center", dataSourcePane);
frame.getContentPane ().add ("South", okButton);
// Pack the frame.
frame.pack ();
//Display the pane and OK button.
frame.show ();</pre>
</div>
</div>
</body>
</html>