You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@db.apache.org by rh...@apache.org on 2012/12/19 19:20:28 UTC

svn commit: r843115 [22/44] - in /websites/production/db/content/derby: ./ binaries/ blogs/ blogs/images/ dev/ docs/ images/ integrate/ integrate/plugin_help/ integrate/plugin_help/images/ logo/ manuals/ papers/ papers/DerbyTut/ releases/ skin/ skin/cs...

Added: websites/production/db/content/derby/papers/DerbyTut/ns_intro.html
==============================================================================
--- websites/production/db/content/derby/papers/DerbyTut/ns_intro.html (added)
+++ websites/production/db/content/derby/papers/DerbyTut/ns_intro.html Wed Dec 19 18:20:21 2012
@@ -0,0 +1,862 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.8">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Step 4: Derby Network Server</title>
+<link type="text/css" href="../../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../../skin/profile.css" rel="stylesheet">
+<script src="../../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">apache</a> &gt; <a href="http://db.apache.org/">db</a><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://db.apache.org/derby"><img class="logoImage" alt="Apache Derby" src="../../images/derby-logo-web.png" title="Derby is a zero-admin Java RDBMS"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href="http://db.apache.org"><img class="logoImage" alt="Apache DB Project" src="../../images/db-logo-white.png" title="Apache DB creates and maintains database solutions."></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs">
+<li>
+<a class="unselected" href="../../index.html">Home</a>
+</li>
+<li>
+<a class="unselected" href="../../quick_start.html">Quick Start</a>
+</li>
+<li>
+<a class="unselected" href="../../derby_downloads.html">Download</a>
+</li>
+<li>
+<a class="unselected" href="../../derby_comm.html">Community</a>
+</li>
+<li>
+<a class="unselected" href="../../manuals/index.html">Documentation</a>
+</li>
+<li class="current">
+<a class="selected" href="../../blogs/index.html">Resources</a>
+</li>
+</ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_1.1', '../../skin/')" id="menu_1.1Title" class="menutitle">Blogs and Articles About Derby</div>
+<div id="menu_1.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../blogs/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#blogs">Blogs</a>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3', '../../skin/')" id="menu_1.1.3Title" class="menutitle">Articles</div>
+<div id="menu_1.1.3" class="menuitemgroup">
+<div onclick="SwitchMenu('menu_1.1.3.1', '../../skin/')" id="menu_1.1.3.1Title" class="menutitle">Tutorials, Tips and Tuning</div>
+<div id="menu_1.1.3.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../blogs/index.html#getstarted">Getting Started</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#features">Features, Hints and Tips</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#security">Security</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#performance">Performance and Tuning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.2', '../../skin/')" id="menu_1.1.3.2Title" class="menutitle">Tools and Migration</div>
+<div id="menu_1.1.3.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../blogs/index.html#tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#migration">Migration</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.3', '../../skin/')" id="menu_1.1.3.3Title" class="menutitle">Applications</div>
+<div id="menu_1.1.3.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../blogs/index.html#client">Client</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#middletier">Middle Tier</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#persistence">Persistence</a>
+</div>
+<div class="menuitem">
+<a href="../../blogs/index.html#scalability">Scalability and Failover</a>
+</div>
+</div>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.2', '../../skin/')" id="menu_1.2Title" class="menutitle">Integration With Other Products</div>
+<div id="menu_1.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../integrate/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../../integrate/index.html#uses">What works with Derby?</a>
+</div>
+<div class="menuitem">
+<a href="../../integrate/index.html#products">Product Writeups</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.3', '../../skin/')" id="menu_1.3Title" class="menutitle">Eclipse Plug-ins</div>
+<div id="menu_1.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../integrate/derby_plugin_info.html">Info</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4', '../../skin/')" id="menu_selected_1.4Title" class="menutitle" style="background-image: url('../../skin/images/chapter_open.gif');">Papers and Presentations</div>
+<div id="menu_selected_1.4" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../../papers/index.html">Overview</a>
+</div>
+<div onclick="SwitchMenu('menu_1.4.2', '../../skin/')" id="menu_1.4.2Title" class="menutitle">Derby Engine</div>
+<div id="menu_1.4.2" class="menuitemgroup">
+<div onclick="SwitchMenu('menu_1.4.2.1', '../../skin/')" id="menu_1.4.2.1Title" class="menutitle">Javadoc</div>
+<div id="menu_1.4.2.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine">Engine</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/language">Language</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/publishedapi">API</a>
+</div>
+</div>
+<div class="menuitem">
+<a href="../../papers/derby_arch.html">Architecture</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/btree_package.html">BTree</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/derby_htw.html">How Things Work</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/Intersect-design.html">Intersect &amp; Except</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/JDBCImplementation.html">JDBC</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/logformats.html">Log Format</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/recovery.html">Logging &amp; Recovery</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/optimizer.html">Optimizer</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine/org/apache/derby/iapi/types/package-summary.html#package_description">Type System</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/versionupgrade.html">Versioning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.3', '../../skin/')" id="menu_1.4.3Title" class="menutitle">Derby Network Client</div>
+<div id="menu_1.4.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../papers/DerbyClientSpec.html">Functional Spec</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4.4', '../../skin/')" id="menu_selected_1.4.4Title" class="menutitle" style="background-image: url('../../skin/images/chapter_open.gif');">Derby Tutorial</div>
+<div id="menu_selected_1.4.4" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../../papers/DerbyTut/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/DerbyTut/install_software.html">Step 1: Install Software</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/DerbyTut/ij_intro.html">Step 2: ij Basics</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/DerbyTut/embedded_intro.html">Step 3: Embedded Derby</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Step 4: Derby Network Server</div>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.5', '../../skin/')" id="menu_1.4.5Title" class="menutitle">Presentations</div>
+<div id="menu_1.4.5" class="menuitemgroup">
+<div class="menuitem">
+<a href="../../papers/ApacheCon.html">ApacheCon</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/MiscPresentations.html#Victorian+Java+User+Group">Victorian JUG 2008</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/MiscPresentations.html#OSCON+2005">OSCON 2005</a>
+</div>
+<div class="menuitem">
+<a href="../../papers/MiscPresentations.html#Colorado+Software+Summit+2004">Colorado 2004</a>
+</div>
+</div>
+</div>
+<!--+
+    |start Search
+    +-->
+<div class="searchbox">
+<hr>
+<form action="http://www.google.com/search" method="get">
+<input value="db.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="18" name="q" id="query" type="text" value="Search the site with google">&nbsp; 
+                  <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+    |end search
+    +-->
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+<div id="credit2"></div>
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div class="trail">Font size: 
+	          &nbsp;<input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button">      
+	          &nbsp;<input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button">
+	          &nbsp;<input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button">
+</div>
+<h1>Step 4: Derby Network Server</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#ns_intro">Introduction</a>
+</li>
+<li>
+<a href="#ns">Derby Network Server</a>
+<ul class="minitoc">
+<li>
+<a href="#ns_config_env">Configure environment</a>
+</li>
+<li>
+<a href="#start_ns">Start Network Server</a>
+</li>
+<li>
+<a href="#ns_easier_way">An easier way: derbyrun.jar</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#ns_sample">Sample Application</a>
+<ul class="minitoc">
+<li>
+<a href="#configure_ns_client">Configure environment to use Derby Network Client JDBC driver</a>
+</li>
+<li>
+<a href="#ij_ns_client">Test network server connection with ij</a>
+</li>
+<li>
+<a href="#copy_ns_client">Copy sample application</a>
+</li>
+<li>
+<a href="#ns_lookat_code">A quick look at the code</a>
+<ul class="minitoc">
+<li>
+<a href="#jdbc_ns_client">Load the Client JDBC Driver</a>
+</li>
+<li>
+<a href="#url_ns_client">Get a Network Server Connection</a>
+</li>
+<li>
+<a href="#ns_client_noshutdown">Don't shut Derby down</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#compile_ns_client">Compile Sample Application</a>
+</li>
+<li>
+<a href="#run_ns_client">Run Sample Application</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#stop_ns">Stop Network Server</a>
+</li>
+<li>
+<a href="#ns_next_steps">Next Steps</a>
+<ul class="minitoc">
+<li>
+<a href="#Network+Server+Options">Network Server Options</a>
+</li>
+<li>
+<a href="#Embedded+Server">Embedded Server</a>
+</li>
+</ul>
+</li>
+</ul>
+</div> 
+
+
+<a name="N1000D"></a><a name="ns_intro"></a>
+<h2 class="boxed">Introduction</h2>
+<div class="section">
+<p>
+As explained in
+the "<a href="embedded_intro.html">Embedded Derby</a>" section,
+an application can embed Derby, 
+which means that the Derby engine runs in the same JVM as the application.
+</p>
+<p>
+However, an application can also access a Derby database using the more
+familiar client/server mode.
+This is achieved <em>via</em> a framework that embeds Derby and handles
+database requests from applications, including applications running in
+different JVMs on the same machine or on remote machines.
+The Derby Network Server is such a framework. It embeds Derby 
+and manages requests from network clients,
+as depicted in Figure 2.
+</p>
+<p>
+
+<strong>Figure 2: Derby Network Server Architecture</strong>
+
+</p>
+<p>
+
+<img alt="Figure 2: Derby Network Server Architecture" src="network_server.png">
+</p>
+<p>
+This section shows how to start the Derby Network Server,
+configure your environment to use the Derby Network Client JDBC driver,
+and compile and run a simple Java application that uses the network server.
+The information presented here is minimal, just enough to help get new 
+users started.
+For complete information, see part one of the
+<a href="http://db.apache.org/derby/manuals">Derby Server and 
+Administration Guide</a>.
+</p>
+</div>
+
+
+<a name="N10035"></a><a name="ns"></a>
+<h2 class="boxed">Derby Network Server</h2>
+<div class="section">
+<p>
+   First set the
+   <a href="install_software.html#set_derby_install">DERBY_INSTALL</a>
+   environment variable.
+</p>
+<a name="N10042"></a><a name="ns_config_env"></a>
+<h3 class="boxed">Configure environment</h3>
+<p>To start or stop the Network Server,
+      set your <span class="codefrag">CLASSPATH</span> to include the jar files listed below:</p>
+<ul>
+     
+<li> 
+<span class="codefrag">derbynet.jar</span>: contains the code for
+   the Derby Network Server and a reference to the engine jar file (derby.jar)
+     </li>
+	 
+<li>
+<span class="codefrag">derbytools.jar</span>: contains Derby tools
+     </li>
+
+</ul>
+<p>
+   You can set your <span class="codefrag">CLASSPATH</span> explicitly with the command
+   shown below:
+</p>
+<p class="code-block">Windows:
+C:\&gt; set CLASSPATH=%DERBY_INSTALL%\lib\derbytools.jar;%DERBY_INSTALL%\lib\derbynet.jar;.
+</p>
+<p class="code-block">UNIX:
+$ export CLASSPATH=$DERBY_INSTALL/lib/derbytools.jar:$DERBY_INSTALL\lib\derbynet.jar:.
+</p>
+<p>
+   You can also use the script that the Derby software distribution provides 
+   to set <span class="codefrag">CLASSPATH</span>.
+   Change directory to the
+   <span class="codefrag">DERBY_INSTALL/bin</span> directory,
+    then execute
+   <span class="codefrag">setNetworkServerCP.bat</span> (Windows) or
+     <span class="codefrag">setNetworkServerCP.ksh</span> (UNIX), as shown below:
+   </p>
+<p class="code-block">Windows:
+C:\&gt; cd %DERBY_INSTALL%\bin
+C:\Apache\db-derby-10.4.1.3-bin\bin&gt; setNetworkServerCP.bat
+</p>
+<p class="code-block">UNIX:
+$ cd $DERBY_INSTALL/bin
+$ . setNetworkServerCP.ksh
+</p>
+<a name="N10082"></a><a name="start_ns"></a>
+<h3 class="boxed">Start Network Server</h3>
+<p>
+Start the Network server by executing the
+<span class="codefrag">startNetworkServer.bat</span> (Windows) or
+<span class="codefrag">startNetworkServer.ksh</span> (UNIX) script.
+This will start the Network Server up on port 1527 and echo a startup
+message:
+</p>
+<p class="code-block">Windows:
+C:\Apache\db-derby-10.4.1.3-bin\bin&gt; startNetworkServer.bat
+Security manager installed using the Basic server security policy.
+Apache Derby Network Server - 10.4.1.3 - (648739) started and ready to 
+	accept connections on port 1527 at 2008-04-28 17:13:13.921 GMT
+</p>
+<p class="code-block">UNIX:
+$ startNetworkServer.ksh
+Security manager installed using the Basic server security policy.
+Apache Derby Network Server - 10.4.1.3 - (648739) started and ready to 
+	accept connections on port 1527 at 2008-04-30 09:35:55.871 GMT 
+</p>
+<p>
+Messages will continue to be output to this window as the Network Server
+processes connection requests.
+</p>
+<p>
+The Network Server starts Derby, so you'll find the <span class="codefrag">derby.log</span>
+error log in the directory where you start the Network Server.
+</p>
+<a name="N100A3"></a><a name="ns_easier_way"></a>
+<h3 class="boxed">An easier way: derbyrun.jar</h3>
+<p>
+Furthermore, it is much easier to start Network Server now than before,
+due to various jar file improvements. With the latest releases, the
+entire sections "Configure environment" and "Start Network Server" could actually
+be replaced with just one command line:
+</p>
+<p class="code-block">Windows:
+C:\Apache\db-derby-10.4.1.3-bin\lib&gt; java -jar derbyrun.jar server start
+Security manager installed using the Basic server security policy.
+Apache Derby Network Server - 10.4.1.3 - (648739) started and ready to 
+	accept connections on port 1527 at 2008-04-28 17:13:13.921 GMT
+</p>
+<p class="code-block">UNIX:
+$ java -jar derbyrun.jar server start
+Security manager installed using the Basic server security policy.
+Apache Derby Network Server - 10.4.1.3 - (648739) started and ready to 
+	accept connections on port 1527 at 2008-04-30 09:35:55.871 GMT 
+</p>
+</div>
+
+
+<a name="N100B6"></a><a name="ns_sample"></a>
+<h2 class="boxed">Sample Application</h2>
+<div class="section">
+<p>
+   Open a new window and set the
+   <a href="install_software.html#set_derby_install">DERBY_INSTALL</a>
+   environment variable.
+</p>
+<a name="N100C3"></a><a name="configure_ns_client"></a>
+<h3 class="boxed">Configure environment to use Derby Network Client JDBC driver</h3>
+<p>To use the Derby Network Client JDBC driver,
+      set your <span class="codefrag">CLASSPATH</span> to include the jar files listed below:</p>
+<ul>
+     
+<li> 
+<span class="codefrag">derbyclient.jar</span>: contains the JDBC driver
+     </li>
+     
+<li> 
+<span class="codefrag">derbytools.jar</span>:
+           optional, provides the <span class="codefrag">ij</span> tool</li>
+
+</ul>
+<p>
+   You can set your <span class="codefrag">CLASSPATH</span> explicitly with the command
+   shown below:
+</p>
+<p class="code-block">Windows:
+C:\&gt; set CLASSPATH=%DERBY_INSTALL%\lib\derbyclient.jar;%DERBY_INSTALL%\lib\derbytools.jar;.
+</p>
+<p class="code-block">UNIX:
+$ export CLASSPATH=$DERBY_INSTALL/lib/derbyclient.jar:$DERBY_INSTALL/lib/derbytools.jar:.
+</p>
+<p>
+   You can also use the script that the Derby software distribution provides 
+   to set <span class="codefrag">CLASSPATH</span>.
+   Change directory to the
+   <span class="codefrag">DERBY_INSTALL/bin</span> directory,
+    then execute
+    the <span class="codefrag">setNetworkClientCP.bat</span> (Windows) or
+     <span class="codefrag">setNetworkClientCP.ksh</span> (UNIX) script as shown below:
+    </p>
+<p class="code-block">Windows:
+C:\Apache\db-derby-10.4.1.3-bin\bin&gt; setNetworkClientCP.bat
+</p>
+<p class="code-block">UNIX:
+$ . setNetworkClientCP.ksh
+</p>
+<a name="N10107"></a><a name="ij_ns_client"></a>
+<h3 class="boxed">Test network server connection with ij</h3>
+<p>
+   An <strong>embedded</strong> 
+   connection URL that creates and connects to a database
+   looks like this:
+   </p>
+<p class="code-block">java org.apache.derby.tools.ij
+ij&gt; connect 'jdbc:derby:MyDbTest;create=true';</p>
+<p>
+   A Derby Network Client connection URL is very close; just add
+   <span class="codefrag">//localhost:1527/</span> before the database name:
+   </p>
+<p class="code-block">java org.apache.derby.tools.ij
+ij&gt; connect 'jdbc:derby://localhost:1527/MyDbTest;create=true';</p>
+<p>
+   What is the physical location of the newly created database?
+   </p>
+<p>
+   If you use the embedded driver, by default the database is created
+   in the same directory in which <span class="codefrag">ij</span> was started up.
+   If you use the Derby Network Client JDBC driver, 
+   by default the database is created
+   in the directory where the Network Server was started up; 
+   in other words, in
+   <span class="codefrag">DERBY_INSTALL/bin</span>.
+   </p>
+<p>
+   Derby provides many ways to specify the actual location.
+   For example, the connection URL below specifies a full path for the database
+   location:
+   </p>
+<p class="code-block">java org.apache.derby.tools.ij
+ij&gt; connect 'jdbc:derby://localhost:1527//home/bill/DerbyDb/MyDbTest;create=true';</p>
+<p>
+   The <em>Developer's Guide</em> provides information
+   about where Derby looks for databases:
+   </p>
+<ul>
+      
+<li>
+<a href="http://db.apache.org/derby/docs/dev/devguide/cdevdvlp34964.html">Connecting to databases</a>
+</li>
+      
+<li> 
+<a href="http://db.apache.org/derby/docs/dev/devguide/cdevdvlp13018.html">Defining the system directory</a>
+</li>
+   
+</ul>
+<a name="N10149"></a><a name="copy_ns_client"></a>
+<h3 class="boxed">Copy sample application</h3>
+<p>
+   This section uses the same sample application that the 
+   "<a href="embedded_intro.html">Embedded Derby</a>" section uses.
+   </p>
+<p>
+   By default this application runs in embedded mode.
+   If you pass it the <span class="codefrag">derbyclient</span> argument at run time, 
+   then it will
+   create and connect to the database using the Derby Network Client JDBC
+   driver instead.
+   </p>
+<a name="N1015D"></a><a name="ns_lookat_code"></a>
+<h3 class="boxed">A quick look at the code</h3>
+<p>
+   The <span class="codefrag">SimpleApp.java</span> application spends most of its time
+   creating a table, inserting data into that table, and selecting the
+   data back, demonstrating many JDBC calls as it does so.
+   This section highlights the JDBC calls that make this specifically a
+   client/server Derby application.
+   The "<a href="embedded_intro.html#em_lookat_code">Embedded Derby</a>"
+   section shows how to turn the same code into an embedded application.
+   </p>
+<a name="N1016D"></a><a name="jdbc_ns_client"></a>
+<h4>Load the Client JDBC Driver</h4>
+<p>
+   When executed with the <span class="codefrag">derbyclient</span> argument,
+   the <span class="codefrag">SimpleApp</span> application
+   loads the Derby Network Client driver with this code:
+   </p>
+<p class="code-block">driver = "org.apache.derby.jdbc.ClientDriver";
+...
+Class.forName(driver).newInstance();
+</p>
+<a name="N10181"></a><a name="url_ns_client"></a>
+<h4>Get a Network Server Connection</h4>
+<p>
+   When executed with the <span class="codefrag">derbyclient</span> argument,
+   the <span class="codefrag">SimpleApp</span> application
+   creates and connects to the <span class="codefrag">derbyDB</span> database with this code:
+   </p>
+<p class="code-block">protocol = "jdbc:derby://localhost:1527/";
+...
+conn = DriverManager.getConnection(protocol + "derbyDB;create=true", props);
+</p>
+<p>
+   That connection URL, fully constructed, looks like this:
+   </p>
+<p class="code-block">jdbc:derby://localhost:1527/derbyDB;create=true</p>
+<a name="N1019F"></a><a name="ns_client_noshutdown"></a>
+<h4>Don't shut Derby down</h4>
+<p>
+   If you look at the <span class="codefrag">SimpleApp.java</span> code you'll notice that it
+   only shuts Derby down if it's running in embedded mode.
+   When connecting <em>via</em> the Network Server, 
+   other applications might be accessing
+   the same database you are; so, don't shut down the databases or Derby.
+   </p>
+<a name="N101B0"></a><a name="compile_ns_client"></a>
+<h3 class="boxed">Compile Sample Application</h3>
+<p>
+   Compile the sample application as shown below:
+   </p>
+<p class="code-block">javac SimpleApp.java</p>
+<a name="N101BE"></a><a name="run_ns_client"></a>
+<h3 class="boxed">Run Sample Application</h3>
+<p>
+   Run the sample application like this:
+   </p>
+<p class="code-block">java SimpleApp derbyclient</p>
+<p>You should see the output shown below:</p>
+<p class="code-block">SimpleApp starting in derbyclient mode.
+Loaded the appropriate driver.
+Connected to and created database derbyDB
+Created table derbyDB
+Inserted 1956 Webster
+Inserted 1910 Union
+Updated 1956 Webster to 180 Grand
+Updated 180 Grand to 300 Lakeshore
+Verified the rows
+Dropped table derbyDB
+Closed result set and statement
+Committed transaction and closed connection
+SimpleApp finished</p>
+<p>Quick question: 
+      Where is the physical location of the <span class="codefrag">derbyDB</span> database 
+      that the sample application creates?
+   </p>
+<p>
+<em>(Answer: In the default
+   <span class="codefrag">$DERBY_INSTALL/bin</span> location.)
+   </em>
+   
+</p>
+</div>
+
+
+<a name="N101E2"></a><a name="stop_ns"></a>
+<h2 class="boxed">Stop Network Server</h2>
+<div class="section">
+<p>
+Stop the Network server by executing the
+<span class="codefrag">stopNetworkServer.bat</span> (Windows) or
+<span class="codefrag">stopNetworkServer.ksh</span> (UNIX) script, as shown below:
+</p>
+<p class="code-block">Windows:
+C:\&gt; cd %DERBY_INSTALL%\bin
+C:\Apache\db-derby-10.4.1.3-bin\bin&gt; setNetworkServerCP.bat
+C:\Apache\db-derby-10.4.1.3-bin\bin&gt; stopNetworkServer.bat
+</p>
+<p class="code-block">UNIX:
+$ cd $DERBY_INSTALL/bin
+$ . setNetworkServerCP.ksh
+$ stopNetworkServer.ksh
+</p>
+<p>The window running the NetworkServer should output a
+message confirming the shutdown.
+</p>
+<p>Note that, as with <a href="#start_ns">starting the server</a>, there is
+also an easier way to shut down the server. For example:
+</p>
+<p class="code-block">Windows:
+C:\&gt; java -jar %DERBY_INSTALL%\lib\derbyrun.jar server shutdown
+</p>
+<p class="code-block">UNIX:
+$ java -jar $DERBY_INSTALL/lib/derbyrun.jar server shutdown
+</p>
+<p>Run derbyrun.jar without arguments for further usage information.
+derbyrun.jar has been included with Derby releases since the 10.2 release 
+series.
+</p>
+</div>
+
+
+<a name="N1020F"></a><a name="ns_next_steps"></a>
+<h2 class="boxed">Next Steps</h2>
+<div class="section">
+<a name="N10215"></a><a name="Network+Server+Options"></a>
+<h3 class="boxed">Network Server Options</h3>
+<p>
+By default, the Derby Network Server only accepts requests from the
+localhost on port 1527.
+You can modify the Network Server to:
+</p>
+<ul>
+  
+<li>
+<a href="http://db.apache.org/derby/docs/dev/adminguide/tadminappssettingportnumbers.html">Listen on a port other than the default</a>.</li>
+  
+<li>
+<a href="http://db.apache.org/derby/docs/dev/adminguide/cadminnetservsecurity.html">Accept requests from outside the localhost.</a>
+</li>
+  
+<li>
+<a href="http://db.apache.org/derby/docs/dev/adminguide/tadminnetservrun.html">Run in the Java 2 Security Manager</a> for increased security, 
+      which we strongly recommend.
+  </li>
+
+</ul>
+<p>
+For more information about these options, and more, see the
+<a href="http://db.apache.org/derby/manuals">Derby Server and 
+Administration Guide</a>.
+</p>
+<a name="N1023A"></a><a name="Embedded+Server"></a>
+<h3 class="boxed">Embedded Server</h3>
+<p>
+Up until this point,
+this section has focused on how to start and stop
+the Network Server as an independent process.
+</p>
+<p>
+Another option, called the "embedded server",
+allows an application to load the embedded JDBC driver for its own use and
+start the Network Server to allow remote access by applications running
+in other JVMs.
+The application that does this can access the database with either the
+embedded driver or the client driver.
+</p>
+<p>
+Figure 3 depicts an application called
+<span class="codefrag">MyEmbedSrvApp</span> that loads the embedded driver and also
+starts up the Network Server.
+This allows other applications,
+such as <span class="codefrag">ij</span>
+or <span class="codefrag">SimpleApp</span> using the Derby Network Client,
+to connect to the same database <em>via</em> a client JDBC driver.
+</p>
+<p>
+
+<strong>Figure 3: Derby Embedded Server Architecture</strong>
+
+</p>
+<p>
+
+<img alt="Figure 3: Derby Embedded Server Architecture" src="embedded_server.png">
+</p>
+<p>
+While it is certainly <em>possible</em> 
+for <span class="codefrag">MyEmbedSrvApp</span> 
+to use the Derby Network Client JDBC driver, 
+it's probably better for it to use the embedded driver
+because Derby Network Client JDBC database requests incur the
+overhead of going out through the network.
+The embedded server architecture lets
+the application that embeds Derby retain the advantages of
+embedded access while
+also enabling remote access to the same database using another tool,
+such as <span class="codefrag">ij</span>.
+Thus, you end up with the best of both worlds: embedded and client/server.
+</p>
+<p>
+You've reached the end of this Derby tutorial and should now understand
+how to use Derby in the embedded and Network Server frameworks.
+The "<a href="index.html#next">Overview</a>" section provides suggestions
+for how you might use Derby with some other products.
+</p>
+</div>
+
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+        Copyright &copy;
+         2004-2012 Apache Software Foundation</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:derby-user@db.apache.org?subject=Feedback%C2%A0papers/DerbyTut/ns_intro.html">derby-user@db.apache.org</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>

Added: websites/production/db/content/derby/papers/Intersect-design.html
==============================================================================
--- websites/production/db/content/derby/papers/Intersect-design.html (added)
+++ websites/production/db/content/derby/papers/Intersect-design.html Wed Dec 19 18:20:21 2012
@@ -0,0 +1,460 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.8">
+<meta name="Forrest-skin-name" content="pelt">
+<meta name="generator" content="">
+<meta name="" content="">
+<title>Intersect &amp; Except Design</title>
+<link type="text/css" href="../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../skin/profile.css" rel="stylesheet">
+<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">apache</a> &gt; <a href="http://db.apache.org/">db</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://db.apache.org/derby"><img class="logoImage" alt="Apache Derby" src="../images/derby-logo-web.png" title="Derby is a zero-admin Java RDBMS"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href="http://db.apache.org"><img class="logoImage" alt="Apache DB Project" src="../images/db-logo-white.png" title="Apache DB creates and maintains database solutions."></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs">
+<li>
+<a class="unselected" href="../index.html">Home</a>
+</li>
+<li>
+<a class="unselected" href="../quick_start.html">Quick Start</a>
+</li>
+<li>
+<a class="unselected" href="../derby_downloads.html">Download</a>
+</li>
+<li>
+<a class="unselected" href="../derby_comm.html">Community</a>
+</li>
+<li>
+<a class="unselected" href="../manuals/index.html">Documentation</a>
+</li>
+<li class="current">
+<a class="selected" href="../blogs/index.html">Resources</a>
+</li>
+</ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_1.1', '../skin/')" id="menu_1.1Title" class="menutitle">Blogs and Articles About Derby</div>
+<div id="menu_1.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#blogs">Blogs</a>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3', '../skin/')" id="menu_1.1.3Title" class="menutitle">Articles</div>
+<div id="menu_1.1.3" class="menuitemgroup">
+<div onclick="SwitchMenu('menu_1.1.3.1', '../skin/')" id="menu_1.1.3.1Title" class="menutitle">Tutorials, Tips and Tuning</div>
+<div id="menu_1.1.3.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#getstarted">Getting Started</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#features">Features, Hints and Tips</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#security">Security</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#performance">Performance and Tuning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.2', '../skin/')" id="menu_1.1.3.2Title" class="menutitle">Tools and Migration</div>
+<div id="menu_1.1.3.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#migration">Migration</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.3', '../skin/')" id="menu_1.1.3.3Title" class="menutitle">Applications</div>
+<div id="menu_1.1.3.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#client">Client</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#middletier">Middle Tier</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#persistence">Persistence</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#scalability">Scalability and Failover</a>
+</div>
+</div>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.2', '../skin/')" id="menu_1.2Title" class="menutitle">Integration With Other Products</div>
+<div id="menu_1.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../integrate/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../integrate/index.html#uses">What works with Derby?</a>
+</div>
+<div class="menuitem">
+<a href="../integrate/index.html#products">Product Writeups</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.3', '../skin/')" id="menu_1.3Title" class="menutitle">Eclipse Plug-ins</div>
+<div id="menu_1.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../integrate/derby_plugin_info.html">Info</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4', '../skin/')" id="menu_selected_1.4Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Papers and Presentations</div>
+<div id="menu_selected_1.4" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../papers/index.html">Overview</a>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4.2', '../skin/')" id="menu_selected_1.4.2Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Derby Engine</div>
+<div id="menu_selected_1.4.2" class="selectedmenuitemgroup" style="display: block;">
+<div onclick="SwitchMenu('menu_1.4.2.1', '../skin/')" id="menu_1.4.2.1Title" class="menutitle">Javadoc</div>
+<div id="menu_1.4.2.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine">Engine</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/language">Language</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/publishedapi">API</a>
+</div>
+</div>
+<div class="menuitem">
+<a href="../papers/derby_arch.html">Architecture</a>
+</div>
+<div class="menuitem">
+<a href="../papers/btree_package.html">BTree</a>
+</div>
+<div class="menuitem">
+<a href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
+<a href="../papers/derby_htw.html">How Things Work</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Intersect &amp; Except</div>
+</div>
+<div class="menuitem">
+<a href="../papers/JDBCImplementation.html">JDBC</a>
+</div>
+<div class="menuitem">
+<a href="../papers/logformats.html">Log Format</a>
+</div>
+<div class="menuitem">
+<a href="../papers/recovery.html">Logging &amp; Recovery</a>
+</div>
+<div class="menuitem">
+<a href="../papers/optimizer.html">Optimizer</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine/org/apache/derby/iapi/types/package-summary.html#package_description">Type System</a>
+</div>
+<div class="menuitem">
+<a href="../papers/versionupgrade.html">Versioning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.3', '../skin/')" id="menu_1.4.3Title" class="menutitle">Derby Network Client</div>
+<div id="menu_1.4.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/DerbyClientSpec.html">Functional Spec</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.4', '../skin/')" id="menu_1.4.4Title" class="menutitle">Derby Tutorial</div>
+<div id="menu_1.4.4" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/DerbyTut/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/install_software.html">Step 1: Install Software</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/ij_intro.html">Step 2: ij Basics</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/embedded_intro.html">Step 3: Embedded Derby</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/ns_intro.html">Step 4: Derby Network Server</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.5', '../skin/')" id="menu_1.4.5Title" class="menutitle">Presentations</div>
+<div id="menu_1.4.5" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/ApacheCon.html">ApacheCon</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#Victorian+Java+User+Group">Victorian JUG 2008</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#OSCON+2005">OSCON 2005</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#Colorado+Software+Summit+2004">Colorado 2004</a>
+</div>
+</div>
+</div>
+<!--+
+    |start Search
+    +-->
+<div class="searchbox">
+<hr>
+<form action="http://www.google.com/search" method="get">
+<input value="db.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="18" name="q" id="query" type="text" value="Search the site with google">&nbsp; 
+                  <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+    |end search
+    +-->
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+<div id="credit2"></div>
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div class="trail">Font size: 
+	          &nbsp;<input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button">      
+	          &nbsp;<input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button">
+	          &nbsp;<input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button">
+</div>
+<h1>Intersect &amp; Except Design</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Introduction">Introduction</a>
+</li>
+<li>
+<a href="#Execution">Execution</a>
+<ul class="minitoc">
+<li>
+<a href="#Alternative+Execution+Plans">Alternative Execution Plans</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Compilation">Binding, Optimization, and Code Generation</a>
+</li>
+<li>
+<a href="#Parser">Parser</a>
+</li>
+</ul>
+</div>
+<br>
+<br>
+<a name="N1001B"></a><a name="Introduction"></a>
+<h2 class="boxed">Introduction</h2>
+<div class="section">
+<p>Intersect &amp; Except Design<br>Jack Klebanoff<br>Feb. 22 2005<br>
+</p>
+<p>This paper describes the implementation of the INTERSECT and EXCEPT operators. This paper assumes basic familiarity with SQL and the language (compiler) portion of Derby.</p>
+<p>The INTERSECT and EXCEPT operators operate on table expressions producing the intersection and difference, respectively. The syntax is (roughly):</p>
+<p>
+<em>queryExpression</em> INTERSECT [ALL] <em>queryExpression</em>
+<br>
+<em>queryExpression</em> EXCEPT [ALL] <em>queryExpression</em>
+<br>
+</p>
+<p>By default these operators remove duplicates, which can occur if there are duplicates in the inputs. If ALL is specified then duplicates are not removed. If t1 has m copies of row R and t2 has n copies then t1 INTERSECT ALL t2 returns min(m,n) copies of R, and t1 EXCEPT ALL t2 returns max( 0, m-n) copies of R.</p>
+<p>The EXCEPT operator has the same precedence as UNION. INTERSECT has higher precedence.</p>
+<p>The implementation is spread across several classes, primarily</p>
+<ol>
+<li>SetOpResultSet, which handles <a href="#Execution">execution</a> of the INTERSECT and EXCEPT operators,</li>
+<li>extensions to QueryTreeNode, which handle <a href="#Compilation">binding, optimization, and code generation</a>, and</li>
+<li>
+<a href="#Parser">the parser</a>.</li>
+</ol>
+</div>
+<a name="N1004F"></a><a name="Execution"></a>
+<h2 class="boxed">Execution</h2>
+<div class="section">
+<p>If the left and right inputs have N and M rows respectively the sorts take time O(N*log(N) + M*log(M)). The final scan takes time O(N + M). So the time for the whole operation is O(N*log(N) + M*log(M)).</p>
+<a name="N10057"></a><a name="Alternative+Execution+Plans"></a>
+<h3 class="boxed">Alternative Execution Plans</h3>
+<p>Other implementations are possible.</p>
+<ol>
+<li>INTERSECT and EXCEPT can be implemeted using hash tables. You can build a hash table on the right input. Then, if you somehow know that the rows in the left input are unique, you can scan through the rows of the left input and output each one that is found/not found in the hash table. If the size of the right input is known at the start then the hash table can be built in time O(M). If the size is not known ahead of time then the hash table can be built in time O(M*log(M)). If the hash function is good then the final scan step takes time O(N). Keeping track of duplicates slows things down. You can keep a hash table of output rows or mark found rows in the right input hash table. <p>Hash tables were rejected because, when the INTERSECT and EXCEPT operations were implemeted, BackingStoreHashtable did not spill to disk. A hash table implementation could exhaust memory.</p>
+</li>
+<li>If the right input is a base table with a unique index then we could forgo sorting the right input and use the index to find rows that match the left rows. Unless the left rows are known to be unique we must sort them or build a hash table to handle duplicates. Using a hash table to eliminate duplicates the time to perform the INTERSECT or EXCEPT would be O(N*log(M) + N'*log(N')), where N' is the number of output rows (N' &lt; N). So this is usually faster than the sort merge method, but it cannot always be used.</li>
+</ol>
+<p>The current implementation was chosen because it always provides at least decent speed and memory utilization, and in many, though certainly not all cases, it is the best implementation.</p>
+<p>We could have provided several implementations and let the optimizer choose the best, but this does not seem worthwhile for operations that are seldom used.</p>
+</div>
+<a name="N10068"></a><a name="Compilation"></a>
+<h2 class="boxed">Binding, Optimization, and Code Generation</h2>
+<div class="section">
+<p>The INTERSECT and EXCEPT operators are bound much like the UNION operator. The bind methods are all found in super class SetOperatorNode, which is shared with UnionNode.</p>
+<p>IntersectOrExceptNode generates OrderByNodes for its inputs at the start of optimization, in the preprocess phase. Any column ordering can be used for the sorts, as long as the same one is used for both the left and right inputs. IntersectOrExceptNode tries to be a little clever about picking the column ordering for the sorts. If the INTERSECT or EXCEPT output must be ordered then IntersectOrExceptNode uses the ORDER BY columns as the most significant part of the sort key for its inputs. Any columns not in the ORDER BY list are tacked on to the least significant part of the sort keys of the inputs. This ensures that the output of the INTERSECT or EXCEPT will be properly ordered without an additional sort step.</p>
+<p>The architecture of the Derby optimizer makes it difficult to do further optimizations. SelectNode processing requires that order by lists be pushed down to them at the start of preprocessing. If an input to INTERSECT or EXCEPT is a SELECT (a common case) then IntersectOrExceptNode has to decide whether it needs its inputs ordered before it calls the preprocess method of its inputs. That means that it must chose its execution plan at the start of the optimization process, not as the result of the optimization process.</p>
+<p>Code generation is straighforward. It generates code that invokes the ResultSetFactory.getSetOpResultSet method.</p>
+</div>
+<a name="N10076"></a><a name="Parser"></a>
+<h2 class="boxed">Parser</h2>
+<div class="section">
+<p>The UNION and EXCEPT operators have the same precedence. The INTERSECT operator has higher precedence, so</p>
+<pre class="code">t1 EXCEPT t2 UNION t3</pre>
+<pre class="code">(t1 EXCEPT t2) UNION t3</pre>
+<pre class="code">t1 UNION ALL t2 UNION t3</pre>
+<pre class="code">(t1 UNION ALL t2) UNION t3</pre>
+<pre class="code">t1 EXCEPT t2 INTERSECT t3</pre>
+<pre class="code">t1 EXCEPT (t2 INTERSECT t3)</pre>
+<p>Note that the EXCEPT operator is not associative, nor is UNION ALL associative with UNION, so the correct associativity is important, even when the query expression uses the same operator.</p>
+<pre class="code">t1 EXCEPT (t2 EXCEPT t3)</pre>
+<strong>not</strong>
+<pre class="code">(t1 EXCEPT t2) EXCEPT t3</pre>
+<p>This precedence and associativity is implemented in the structure of queryExpression. The higher precedence of the INTERSECT operator is implemented by building queryExpression out of nonJoinQueryTerm. A nonJoinQueryTerm consists of one or more nonJoinQueryPrimaries connected by INTERSECT operators. A queryExpression consists of one or more nonJoinQueryTerms connected by EXCEPT or UNION operators.</p>
+<p>Our parser is a recursive descent parser. Recursive descent parsers want recursion on the right. Therefore they do not handle SQL's operator associativity naturally. The natural grammar for queryExpression is<br>
+</p>
+<pre>
+<em>queryExpression</em> ::=
+  <em>nonJoinQueryTerm</em> |
+  <em>queryExpression</em> <strong>UNION</strong> [<strong>ALL</strong>] <em>nonJoinQueryTerm</em> |
+  <em>queryExpression</em> <strong>EXCEPT</strong> [<strong>ALL</strong>] <em>nonJoinQueryTerm</em>
+
+</pre>
+<pre>
+<span class="codefrag">ResultSetNode
+queryExpression(ResultSetNode leftSide, int operatorType) throws StandardException :
+{
+    ResultSetNode term;
+}
+{
+    term = nonJoinQueryTerm(leftSide, operatorType) [ term = unionOrExcept(term) ]
+    {
+        return term;
+    }
+}
+ResultSetNode
+unionOrExcept(ResultSetNode term) throws StandardException :
+{
+    ResultSetNode expression;
+    Token tok = null;
+}
+{
+     [ tok =  ]
+        expression = queryExpression(term, (tok != null) ? UNION_ALL_OP : UNION_OP)
+    {
+        return expression;
+    }
+|
+     [ tok =  ]
+        expression = queryExpression(term, (tok != null) ? EXCEPT_ALL_OP : EXCEPT_OP)
+    {
+        return expression;
+    }
+}
+</span>
+
+</pre>
+<p>The creation of union, intersect, or except query tree nodes is done in the nonJoinQueryTerm method.</p>
+<p>[<a href="index.html">Back to Derby Papers</a>]</p>
+</div>
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+        Copyright &copy;
+         2004-2012 Apache Software Foundation</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:derby-user@db.apache.org?subject=Feedback%C2%A0papers/Intersect-design.html">derby-user@db.apache.org</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>

Added: websites/production/db/content/derby/papers/JDBCImplementation.html
==============================================================================
--- websites/production/db/content/derby/papers/JDBCImplementation.html (added)
+++ websites/production/db/content/derby/papers/JDBCImplementation.html Wed Dec 19 18:20:21 2012
@@ -0,0 +1,868 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.8">
+<meta name="Forrest-skin-name" content="pelt">
+<meta name="generator" content="">
+<meta name="" content="">
+<meta name="GENERATOR" content="">
+<meta name="CREATED" content="">
+<meta name="CHANGED" content="">
+<meta name="ProgId" content="">
+<meta name="Originator" content="">
+<title>Derby JDBC Implementation Notes</title>
+<link type="text/css" href="../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../skin/profile.css" rel="stylesheet">
+<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">apache</a> &gt; <a href="http://db.apache.org/">db</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://db.apache.org/derby"><img class="logoImage" alt="Apache Derby" src="../images/derby-logo-web.png" title="Derby is a zero-admin Java RDBMS"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href="http://db.apache.org"><img class="logoImage" alt="Apache DB Project" src="../images/db-logo-white.png" title="Apache DB creates and maintains database solutions."></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs">
+<li>
+<a class="unselected" href="../index.html">Home</a>
+</li>
+<li>
+<a class="unselected" href="../quick_start.html">Quick Start</a>
+</li>
+<li>
+<a class="unselected" href="../derby_downloads.html">Download</a>
+</li>
+<li>
+<a class="unselected" href="../derby_comm.html">Community</a>
+</li>
+<li>
+<a class="unselected" href="../manuals/index.html">Documentation</a>
+</li>
+<li class="current">
+<a class="selected" href="../blogs/index.html">Resources</a>
+</li>
+</ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_1.1', '../skin/')" id="menu_1.1Title" class="menutitle">Blogs and Articles About Derby</div>
+<div id="menu_1.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#blogs">Blogs</a>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3', '../skin/')" id="menu_1.1.3Title" class="menutitle">Articles</div>
+<div id="menu_1.1.3" class="menuitemgroup">
+<div onclick="SwitchMenu('menu_1.1.3.1', '../skin/')" id="menu_1.1.3.1Title" class="menutitle">Tutorials, Tips and Tuning</div>
+<div id="menu_1.1.3.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#getstarted">Getting Started</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#features">Features, Hints and Tips</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#security">Security</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#performance">Performance and Tuning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.2', '../skin/')" id="menu_1.1.3.2Title" class="menutitle">Tools and Migration</div>
+<div id="menu_1.1.3.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#migration">Migration</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.1.3.3', '../skin/')" id="menu_1.1.3.3Title" class="menutitle">Applications</div>
+<div id="menu_1.1.3.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../blogs/index.html#client">Client</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#middletier">Middle Tier</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#persistence">Persistence</a>
+</div>
+<div class="menuitem">
+<a href="../blogs/index.html#scalability">Scalability and Failover</a>
+</div>
+</div>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.2', '../skin/')" id="menu_1.2Title" class="menutitle">Integration With Other Products</div>
+<div id="menu_1.2" class="menuitemgroup">
+<div class="menuitem">
+<a href="../integrate/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../integrate/index.html#uses">What works with Derby?</a>
+</div>
+<div class="menuitem">
+<a href="../integrate/index.html#products">Product Writeups</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.3', '../skin/')" id="menu_1.3Title" class="menutitle">Eclipse Plug-ins</div>
+<div id="menu_1.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../integrate/derby_plugin_info.html">Info</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4', '../skin/')" id="menu_selected_1.4Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Papers and Presentations</div>
+<div id="menu_selected_1.4" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a href="../papers/index.html">Overview</a>
+</div>
+<div onclick="SwitchMenu('menu_selected_1.4.2', '../skin/')" id="menu_selected_1.4.2Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Derby Engine</div>
+<div id="menu_selected_1.4.2" class="selectedmenuitemgroup" style="display: block;">
+<div onclick="SwitchMenu('menu_1.4.2.1', '../skin/')" id="menu_1.4.2.1Title" class="menutitle">Javadoc</div>
+<div id="menu_1.4.2.1" class="menuitemgroup">
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine">Engine</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/language">Language</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/tools">Tools</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/publishedapi">API</a>
+</div>
+</div>
+<div class="menuitem">
+<a href="../papers/derby_arch.html">Architecture</a>
+</div>
+<div class="menuitem">
+<a href="../papers/btree_package.html">BTree</a>
+</div>
+<div class="menuitem">
+<a href="../papers/pageformats.html">Disk Page Format</a>
+</div>
+<div class="menuitem">
+<a href="../papers/derby_htw.html">How Things Work</a>
+</div>
+<div class="menuitem">
+<a href="../papers/Intersect-design.html">Intersect &amp; Except</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">JDBC</div>
+</div>
+<div class="menuitem">
+<a href="../papers/logformats.html">Log Format</a>
+</div>
+<div class="menuitem">
+<a href="../papers/recovery.html">Logging &amp; Recovery</a>
+</div>
+<div class="menuitem">
+<a href="../papers/optimizer.html">Optimizer</a>
+</div>
+<div class="menuitem">
+<a href="http://db.apache.org/derby/javadoc/engine/org/apache/derby/iapi/types/package-summary.html#package_description">Type System</a>
+</div>
+<div class="menuitem">
+<a href="../papers/versionupgrade.html">Versioning</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.3', '../skin/')" id="menu_1.4.3Title" class="menutitle">Derby Network Client</div>
+<div id="menu_1.4.3" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/DerbyClientSpec.html">Functional Spec</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.4', '../skin/')" id="menu_1.4.4Title" class="menutitle">Derby Tutorial</div>
+<div id="menu_1.4.4" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/DerbyTut/index.html">Overview</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/install_software.html">Step 1: Install Software</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/ij_intro.html">Step 2: ij Basics</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/embedded_intro.html">Step 3: Embedded Derby</a>
+</div>
+<div class="menuitem">
+<a href="../papers/DerbyTut/ns_intro.html">Step 4: Derby Network Server</a>
+</div>
+</div>
+<div onclick="SwitchMenu('menu_1.4.5', '../skin/')" id="menu_1.4.5Title" class="menutitle">Presentations</div>
+<div id="menu_1.4.5" class="menuitemgroup">
+<div class="menuitem">
+<a href="../papers/ApacheCon.html">ApacheCon</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#Victorian+Java+User+Group">Victorian JUG 2008</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#OSCON+2005">OSCON 2005</a>
+</div>
+<div class="menuitem">
+<a href="../papers/MiscPresentations.html#Colorado+Software+Summit+2004">Colorado 2004</a>
+</div>
+</div>
+</div>
+<!--+
+    |start Search
+    +-->
+<div class="searchbox">
+<hr>
+<form action="http://www.google.com/search" method="get">
+<input value="db.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="18" name="q" id="query" type="text" value="Search the site with google">&nbsp; 
+                  <input name="Search" value="Search" type="submit">
+</form>
+</div>
+<!--+
+    |end search
+    +-->
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+<div id="credit2"></div>
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div class="trail">Font size: 
+	          &nbsp;<input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button">      
+	          &nbsp;<input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button">
+	          &nbsp;<input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button">
+</div>
+<h1>Derby JDBC Implementation Notes</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Overview">Overview</a>
+</li>
+<li>
+<a href="#Java.sql.Connection">Java.sql.Connection</a>
+<ul class="minitoc">
+<li>
+<a href="#CreateStatement%2C+prepareStatement+and+prepareCall">CreateStatement, prepareStatement and prepareCall</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Java.sql.PreparedStatement">Java.sql.PreparedStatement</a>
+<ul class="minitoc">
+<li>
+<a href="#setAsciiStream%2CsetBinaryStream%2CsetCharacterStream">setAsciiStream,setBinaryStream,setCharacterStream</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Java.sql.ResultSet">Java.sql.ResultSet</a>
+<ul class="minitoc">
+<li>
+<a href="#deleteRow%28%29">deleteRow()</a>
+</li>
+<li>
+<a href="#updateRow%28%29">updateRow()</a>
+</li>
+<li>
+<a href="#GetAsciiStream%28%29">GetAsciiStream()</a>
+</li>
+<li>
+<a href="#GetBinaryStream%28%29">GetBinaryStream()</a>
+</li>
+<li>
+<a href="#GetCharacterStream%28%29">GetCharacterStream()</a>
+</li>
+<li>
+<a href="#GetString%28%29">GetString()</a>
+</li>
+<li>
+<a href="#GetUnicodeStream%28%29">GetUnicodeStream()</a>
+</li>
+<li>
+<a href="#Examples">Examples</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#java.sql.Blob">java.sql.Blob</a>
+<ul class="minitoc">
+<li>
+<a href="#getBytes%28int+pos%2C+int+length%29">getBytes(int pos, int length)</a>
+</li>
+<li>
+<a href="#position%28byte+pattern%2C+int+start%29+and+position%28Blob+pattern%2C+int+start%29">position(byte pattern, int start) and position(Blob pattern, int start)</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#java.sql.Clob">java.sql.Clob</a>
+<ul class="minitoc">
+<li>
+<a href="#getSubString%28int+pos%2C+int+length%29">getSubString(int pos, int length)</a>
+</li>
+<li>
+<a href="#position%28String+searchstr%2C+int+start%29+and">position(String searchstr, int start) andposition(Clob searchstr, int start)</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Date+Handling">Date Handling</a>
+<ul class="minitoc">
+<li>
+<a href="#Derby+SQL+DATE">Derby SQL DATE</a>
+<ul class="minitoc">
+<li>
+<a href="#java.sql.Date">java.sql.Date</a>
+</li>
+<li>
+<a href="#Conversion+of+a+JDBC+java.sql.Date+to+a+Derby+DATE+value">Conversion of a JDBC java.sql.Date to a Derby DATE value</a>
+</li>
+<li>
+<a href="#Conversion+of+a+Derby+DATE+value+to+a+JDBC+java.sql.Date">Conversion of a Derby DATE value to a JDBC java.sql.Date</a>
+</li>
+<li>
+<a href="#Conversion+of+a+string+type+to+a+JDBC+java.sql.Date">Conversion of a string type to a JDBC java.sql.Date</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Derby+SQL+TIME">Derby SQL TIME</a>
+<ul class="minitoc">
+<li>
+<a href="#java.sql.Time">java.sql.Time</a>
+</li>
+<li>
+<a href="#Conversion+of+a+JDBC+java.sql.Time+to+a+Derby+TIME+value">Conversion of a JDBC java.sql.Time to a Derby TIME value</a>
+</li>
+<li>
+<a href="#Conversion+of+a+Derby+TIME+value+to+a+JDBC+java.sql.Time">Conversion of a Derby TIME value to a JDBC java.sql.Time</a>
+</li>
+<li>
+<a href="#Conversion+of+a+string+type+to+a+JDBC+java.sql.Time">Conversion of a string type to a JDBC java.sql.Time</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Derby+SQL+TIMESTAMP">Derby SQL TIMESTAMP</a>
+<ul class="minitoc">
+<li>
+<a href="#java.sql.Timestamp">java.sql.Timestamp</a>
+</li>
+<li>
+<a href="#Conversion+of+a+JDBC+java.sql.Timestamp+to+a+Derby+TIMESTAMP+value">Conversion of a JDBC java.sql.Timestamp to a Derby TIMESTAMP value</a>
+</li>
+<li>
+<a href="#Conversion+of+a+Derby+TIMESTAMP+value+to+a+JDBC+java.sql.Timestamp">Conversion of a Derby TIMESTAMP value to a JDBC java.sql.Timestamp</a>
+</li>
+<li>
+<a href="#Conversion+of+a+string+type+to+a+JDBC+java.sql.Timestamp">Conversion of a string type to a JDBC java.sql.Timestamp</a>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+<a name="N10049"></a><a name="Overview"></a>
+<h2 class="boxed">Overview</h2>
+<div class="section">
+<p>The JDBC specification is sometimes unclear or contradictory. This document covers how Derby implements some JDBC features where the specification might be unclear.</p>
+<p>The JDBC 3.0 specicification is in theory a single document however clarifications or additional information can also be found in the Javadoc for java.sql and javax.sql, and in the offical JDBC tutorial book.</p>
+<p>[JDBC3] &ndash; Downloadable from <a class="external" href="http://java.sun.com/products/jdbc/index.jsp">http://java.sun.com/products/jdbc/index.jsp</a>
+</p>
+<p>[JAVADOC14] &ndash; downloadable from <a class="external" href="http://java.sun.com/products/jdbc/index.jsp">http://java.sun.com/products/jdbc/index.jsp</a>
+</p>
+<p>[TUTORIAL3] &ndash; JDBC API Tutorial and Reference, Third Edition. ISBN 0321173848 <a class="external" href="http://java.sun.com/developer/Books/jdbc/Fisher/index.html">http://java.sun.com/developer/Books/jdbc/Fisher/index.html</a>
+</p>
+</div>
+<a name="N10060"></a><a name="Java.sql.Connection"></a>
+<h2 class="boxed">Java.sql.Connection</h2>
+<div class="section">
+<a name="N10064"></a><a name="CreateStatement%2C+prepareStatement+and+prepareCall"></a>
+<h3 class="boxed">CreateStatement, prepareStatement and prepareCall</h3>
+<p>Behavior Clarification</p>
+<p>CONCUR_UPDATABLE concurrency is supported for FORWARD ONLY ResultSet types only.</p>
+</div>
+<a name="N1006C"></a><a name="Java.sql.PreparedStatement"></a>
+<h2 class="boxed">Java.sql.PreparedStatement</h2>
+<div class="section">
+<a name="N10070"></a><a name="setAsciiStream%2CsetBinaryStream%2CsetCharacterStream"></a>
+<h3 class="boxed">setAsciiStream,setBinaryStream,setCharacterStream</h3>
+<p>Behavior Clarification</p>
+<p>In Derby, the stream must have the exact amount of data as the length argument, otherwise an exception with the following message 'Input Stream did not have exact amount of data as the requested length' is thrown.</p>
+<p>Stream parameter values are not re-used. The JDBC 3.0 specification says in the last paragraph of 13.2.2 that parameters are re-used but nothing special about streams. However javadoc for java.sql.PreparedStatement.clearParamters() says 'In general, parameter values remain in force for repeated use of a statement'. Maybe 'in general' can be interpreted to mean 'except for streams'. Stream parameter values are not re-used and if a stream is re-used, the statement execution will fail with 'Stream has already been read and end-of-file reached and cannot be re-used.'.</p>
+</div>
+<a name="N1007A"></a><a name="Java.sql.ResultSet"></a>
+<h2 class="boxed">Java.sql.ResultSet</h2>
+<div class="section">
+<p>Support for data conversion using the getXXX() methods matches Table B-6 in the [JDBC3], with some extensions described below.</p>
+<p>Extension</p>
+<p>If the value column is null, then generally any getXXX method can be used to fetch the null value and a null or a representation of zero will be returned and a subsequent call to wasNull() will return true. It is not recommended that applications take advantage of this liberal conversion of SQL NULL values, use of a getXXX() method that works against NULL and non-NULL values is strongly recommended.</p>
+<a name="N10084"></a><a name="deleteRow%28%29"></a>
+<h3 class="boxed">deleteRow()</h3>
+<p>Behavior Clarification</p>
+<p>After deleteRow, ResultSet will be positioned right before the next row for FORWARD ONLY updatable ResultSets.</p>
+<a name="N1008C"></a><a name="updateRow%28%29"></a>
+<h3 class="boxed">updateRow()</h3>
+<p>Behavior Clarification</p>
+<p>After updateRow, ResultSet will be positioned right before the next row for FORWARD ONLY updatable ResultSets.</p>
+<a name="N10094"></a><a name="GetAsciiStream%28%29"></a>
+<h3 class="boxed">GetAsciiStream()</h3>
+<p>Behavior Clarification</p>
+<p>An ASCII character is defined as an eight bit character (range 0x00 to 0xff), see CHAR() function definition by [JDBC3] in appendix C.2.</p>
+<p>For character types (Types.CHAR, Types.VARCHAR &amp; Types.LONGVARCHAR) &ndash; Each character in the value is translated to one byte in the ASCII stream, For Unicode characters in the range 0x0000 to 0x00ff, they are translated to a byte with the matching value (0x00 to 0xff). Characters outside this range, (0x0100 to 0xffff) are translated to 0x3f (&lsquo;?&rsquo;).</p>
+<p>For binary types (Types.BINARY, Types.VARBINARY, and Types.LONGVARBINARY) getAsciiStream() returns a stream with identical contents to that returned by getBinaryStream() on the same column.</p>
+<p>Extensions</p>
+<ul>
+<li>
+<p>On Types.CLOB columns returns a stream with identical contents to that returned by getClob().getAsciiStream() on the same column if the CLOB value is not NULL. If the CLOB value is NULL then null is returned.</p>
+</li>
+</ul>
+<ul>
+<li>
+<p>On Types.BLOB columns returns a stream with identical contents to that returned by getBlob().getBinaryStream() on the same column if the BLOB value is not NULL. If the BLOB value is NULL then null is returned.</p>
+</li>
+</ul>
+<p>This method is not recommended to use in Derby.<br>Because Derby handles characters as unicode internally , there is no advantage in using this method .</p>
+<a name="N100AE"></a><a name="GetBinaryStream%28%29"></a>
+<h3 class="boxed">GetBinaryStream()</h3>
+<p>Extensions</p>
+<p>On Types.BLOB columns returns a stream with identical contents to that returned by getBlob().getBinaryStream() on the same column if the BLOB value is not NULL. If the BLOB value is NULL then null is returned.</p>
+<a name="N100B6"></a><a name="GetCharacterStream%28%29"></a>
+<h3 class="boxed">GetCharacterStream()</h3>
+<p>Behavior Clarification</p>
+<p>For binary types (Types.BINARY, Types.VARBINARY, and Types.LONGVARBINARY, Types.BLOB) getString() the value is converted to a stream of characters as though it is encoded using UTF-16BE.</p>
+<p>Extensions</p>
+<ul>
+<li>
+<p>On Types.CLOB columns returns a reader with identical contents to that returned by getClob().getCharacterStream() on the same column if the CLOB value is not NULL. If the CLOB value is NULL then null is returned.</p>
+</li>
+</ul>
+<ul>
+<li>
+<p>On Types.BLOB columns supported with conversion as a binary type.</p>
+</li>
+</ul>
+<a name="N100C8"></a><a name="GetString%28%29"></a>
+<h3 class="boxed">GetString()</h3>
+<p>Behavior Clarification</p>
+<p>For binary types (Types.BINARY, Types.VARBINARY, and Types.LONGVARBINARY, Types.BLOB) getString() returns String containing a two character hexadecimal representation for every byte in a non-null value.&nbsp; The two characters are in the range &lsquo;0&rsquo; &ndash; &lsquo;9&rsquo; and &lsquo;a&rsquo; &ndash; &lsquo;f&rsquo;. For NULL values, null is returned. Note, that this String does not match the contents of the stream returned by getAsciiStream or getCharacterStream on the same column.</p>
+<p>Extensions</p>
+<ul>
+<li>
+<p>On Types.CLOB columns returns a String representing the contents of the CLOB value is not NULL. If the CLOB value is NULL then null is returned.</p>
+</li>
+</ul>
+<ul>
+<li>
+<p>On Types.BLOB columns supported with conversion as a binary type.</p>
+</li>
+</ul>
+<a name="N100DA"></a><a name="GetUnicodeStream%28%29"></a>
+<h3 class="boxed">GetUnicodeStream()</h3>
+<p>Not implemented, deprecated by [JDBC3].</p>
+<a name="N100E0"></a><a name="Examples"></a>
+<h3 class="boxed">Examples</h3>
+<p>Binary Column</p>
+<p>If a binary column has been set with the Java byte array containing fours bytes, byte[] data = {0x34, 0x87, 0xc2, 0x1f} then:</p>
+<div style="margin-left: 2em">
+<ul>
+<li>
+<p>getBinaryStream() returns a java.io.InputStream containing four bytes - 0x34, 0x87, 0xc2, 0x1f</p>
+</li>
+</ul>
+</div>
+<div style="margin-left: 2em">
+<ul>
+<li>
+<p>getAsciiStream() returns a java.io.InputStream containing four bytes -&nbsp; 0x34, 0x87, 0xc2, 0x1f&nbsp; [ same as getBinaryStream() ]</p>
+</li>
+</ul>
+</div>
+<div style="margin-left: 2em">
+<ul>
+<li>
+<p>getCharacterStream() returns a java.io.Reader containing two characters - 0x3487, 0xc21f</p>
+</li>
+<li>
+<p>getString() returns a String with eight characters &ldquo;3487c21f&rdquo;</p>
+</li>
+</ul>
+</div>
+</div>
+<a name="N100FD"></a><a name="java.sql.Blob"></a>
+<h2 class="boxed">java.sql.Blob</h2>
+<div class="section">
+<a name="N10101"></a><a name="getBytes%28int+pos%2C+int+length%29"></a>
+<h3 class="boxed">getBytes(int pos, int length)</h3>
+<p>Behavior Clarification</p>
+<p>If the pos (position) argument is greater than the length of the BLOB then an exception is thrown. This matches the semantics of the SQL SUBSTR function.</p>
+<a name="N10109"></a><a name="position%28byte+pattern%2C+int+start%29+and+position%28Blob+pattern%2C+int+start%29"></a>
+<h3 class="boxed">position(byte pattern, int start) and position(Blob pattern, int start)</h3>
+<p>Behavior Clarification</p>
+<p>If the pattern argument has length zero, then the value of start argument will be returned. This matches the semantics of the SQL LOCATE function.</p>
+</div>
+<a name="N10111"></a><a name="java.sql.Clob"></a>
+<h2 class="boxed">java.sql.Clob</h2>
+<div class="section">
+<a name="N10115"></a><a name="getSubString%28int+pos%2C+int+length%29"></a>
+<h3 class="boxed">getSubString(int pos, int length)</h3>
+<p>Behavior Clarification</p>
+<p>If the pos (position) argument is greater than the length of the CLOB then an exception is thrown. This matches the semantics of the SQL SUBSTR function.</p>
+<a name="N1011D"></a><a name="position%28String+searchstr%2C+int+start%29+and"></a>
+<h3 class="boxed">position(String searchstr, int start) andposition(Clob searchstr, int start)</h3>
+<p>Behavior Clarification</p>
+<p>If the searchstr argument has length zero (the empty string), then the value of start argument will be returned. This matches the semantics of the SQL LOCATE function.</p>
+</div>
+<a name="N10127"></a><a name="Date+Handling"></a>
+<h2 class="boxed">Date Handling</h2>
+<div class="section">
+<a name="N1012B"></a><a name="Derby+SQL+DATE"></a>
+<h3 class="boxed">Derby SQL DATE</h3>
+<p>Derby&rsquo;s SQL DATE type represents a date in the form yyyy-mm-dd with no associated time zone information.</p>
+<a name="N10131"></a><a name="java.sql.Date"></a>
+<h4>java.sql.Date</h4>
+<p>A JDBC Date (java.sql.Date) by definition represents a point in time on a given date in a given time zone.</p>
+<p>[JDBC3] intends that the point in time for a java.sql.Date object is 00:00 (midnight), but this is not enforced by the class.</p>
+<p>JDBC drivers are required to return java.sql.Date objects that are normalized to 00:00 according to the required time zone.</p>
+<p>Applications are expected to pass in java.sql.Date instances that are normalized to 00:00 (see section 18.1.1 of [TUTORIAL3]).</p>
+<a name="N1013D"></a><a name="Conversion+of+a+JDBC+java.sql.Date+to+a+Derby+DATE+value"></a>
+<h4>Conversion of a JDBC java.sql.Date to a Derby DATE value</h4>
+<ol>
+<li>
+<p>setDate() without a Calendar object or passing null for a Calendar object:</p>
+<ul>
+<li>
+<p>The yyyy-mm-dd values will be calculated from the milli-seconds value of the java.sql.Date instance using a Calendar object set to the time zone of the virtual machine.</p>
+</li>
+<li>
+<p>This yyyy-mm-dd value will match the output of java.sql.Date.toString().</p>
+</li>
+</ul>
+</li>
+<li>
+<p>setDate() with a Calendar object:</p>
+<ul>
+<li>
+<p>The yyyy-mm-dd values will be calculated from the milliseconds value of the java.sql.Date instance using the passed in Calendar.</p>
+</li>
+<li>
+<p>The code for this is<br>cal.setTimeInMillis(value.getTime());<br>yyyy = cal.get(Calendar.YEAR);<br>mm = cal.get(Calendar.MONTH) + 1;<br>dd = cal.get(Calendar.DAY_OF_MONTH);</p>
+</li>
+<li>
+<p>This yyyy-mm-dd value may not match the output of java.sql.Date.toString() for the value, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<p>Derby does not require that the application&rsquo;s java.sql.Date value is normalized to 00:00 according to the required time zone.</p>
+<p>In both cases no time zone information is stored with the SQL DATE value.</p>
+<a name="N10165"></a><a name="Conversion+of+a+Derby+DATE+value+to+a+JDBC+java.sql.Date"></a>
+<h4>Conversion of a Derby DATE value to a JDBC java.sql.Date</h4>
+<ol>
+<li>
+<p>getDate() without a Calendar object or passing null for a Calendar object:</p>
+<ul>
+<li>
+<p>A java.sql.Date instance is returned with a millisecond value corresponding to 00:00 on yyyy-mm-dd according to the time zone of the java virtual machine</p>
+</li>
+<li>
+<p>The toString() method of the returned value will return &lsquo;yyyy-mm-dd&rsquo;</p>
+</li>
+</ul>
+</li>
+<li>
+<p>getDate() with a Calendar object:</p>
+<ul>
+<li>
+<p>A java.sql.Date instance is returned with a millisecond value corresponding to 00:00 on yyyy-mm-dd according to the time zone of the Calendar</p>
+</li>
+<li>
+<p>The toString() method of the returned value may not return &lsquo;yyyy-mm-dd&rsquo;, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<a name="N1017E"></a><a name="Conversion+of+a+string+type+to+a+JDBC+java.sql.Date"></a>
+<h4>Conversion of a string type to a JDBC java.sql.Date</h4>
+<p>Three different date formats are built into Derby.</p>
+<div style="margin-left: 2em">
+<ol>
+<li>
+<p>(ISO/JIS) yyyy-mm-dd e.g. &ldquo;1980-03-21&rdquo;,</p>
+</li>
+<li>
+<p>(IBM USA) mm/dd/yyyy e.g. &ldquo;03/21/1980&rdquo;, and</p>
+</li>
+<li>
+<p>(IBM European) dd.mm.yyyy e.g. &ldquo;21.03.1980&rdquo;.</p>
+</li>
+</ol>
+</div>
+<p>If the format of the string matches one of the built in formats then a conversion to a java.sql.Date matches that of a SQL DATE value with value yyyy-mm-dd.</p>
+<p>If the string does not match any of the built in formats Derby attempts to use the Java locale specific parser to interpret the string as a date.</p>
+<a name="N10194"></a><a name="Derby+SQL+TIME"></a>
+<h3 class="boxed">Derby SQL TIME</h3>
+<p>Derby&rsquo;s SQL TIME type represents a time of day in the form hh:mm:ss with no associated time zone information.</p>
+<a name="N1019A"></a><a name="java.sql.Time"></a>
+<h4>java.sql.Time</h4>
+<p>A JDBC Time (java.sql.Time) by definition represents a point in time on an unspecified day in a given time zone.</p>
+<p>Java.sql.Time extends java.util.date, so it includes a date. [JDBC3] intends that the date stored in a java.sql.Time be Jan 1 1970, but this is not enforced by the class.</p>
+<p>JDBC drivers are required to return java.sql.Time objects that are normalized to Jan. 1 1970 according to the required time zone.</p>
+<p>Applications are expected to pass in java.sql.Time instances that are normalized to Jan. 1 1970.</p>
+<a name="N101A6"></a><a name="Conversion+of+a+JDBC+java.sql.Time+to+a+Derby+TIME+value"></a>
+<h4>Conversion of a JDBC java.sql.Time to a Derby TIME value</h4>
+<ol>
+<li>
+<p>setTime() without a Calendar object or passing null for a Calendar object</p>
+<ul>
+<li>
+<p>The hh:mm:ss values will be calculated from the milli-seconds value of the java.sql.Time instance using a Calendar object set to the time zone of the virtual machine.</p>
+</li>
+<li>
+<p>This hh:mm:ss value will match the output of java.sql.Date.toString().</p>
+</li>
+</ul>
+</li>
+<li>
+<p>setTime() with a Calendar object</p>
+<ul>
+<li>
+<p>The hh:mm:ss values will be calculated from the milliseconds value of the java.sql.Date instance using the passed in Calendar.</p>
+</li>
+<li>
+<p>The code for this is<br>cal.setTimeInMillis(value.getTime());<br>hh = cal.get(Calendar.HOUR);<br>mm = cal.get(Calendar.MINUTE);<br>ss = cal.get(Calendar.SECOND);</p>
+</li>
+<li>
+<p>This hh:mm:dd value may not match the output of java.sql.Date.toString() for the value, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<p>Derby does not require that the application&rsquo;s java.sql.Time value be normalized to Jan 1 1970 according to the required time zone.</p>
+<p>In both cases no time zone information is stored with the SQL TIME value.</p>
+<a name="N101CE"></a><a name="Conversion+of+a+Derby+TIME+value+to+a+JDBC+java.sql.Time"></a>
+<h4>Conversion of a Derby TIME value to a JDBC java.sql.Time</h4>
+<ol>
+<li>
+<p>getTime() without a Calendar object or passing null for a Calendar object</p>
+<ul>
+<li>
+<p>A java.sql.Time instance is returned with a millisecond value corresponding to hh:mm:ss on Jan. 1 1970 according to the time zone of the java virtual machine</p>
+</li>
+<li>
+<p>The toString() method of the returned value will return &lsquo;hh:mm:ss&rsquo;.</p>
+</li>
+</ul>
+</li>
+<li>
+<p>getTime() with a Calendar object</p>
+<ul>
+<li>
+<p>A java.sql.Time instance is returned with a millisecond value corresponding to hh:mm:ss on Jan. 1 1970 according to the time zone of the Calendar</p>
+</li>
+<li>
+<p>The toString() method of the returned value may not return &lsquo;hh:mm:ss&rsquo;, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<a name="N101E7"></a><a name="Conversion+of+a+string+type+to+a+JDBC+java.sql.Time"></a>
+<h4>Conversion of a string type to a JDBC java.sql.Time</h4>
+<p>Three different time formats are built into Derby:</p>
+<div style="margin-left: 2em">
+<ol>
+<li>
+<p>(ISO/EUR) hh.mm.ss e.g. &ldquo;13.52.03&rdquo;,</p>
+</li>
+<li>
+<p>(IBM USA) hh:mm [AM|PM] e.g. &ldquo;1:52 PM&rdquo;, and</p>
+</li>
+<li>
+<p>(JIS) hh:mm:ss e.g. &ldquo;13:52:03&rdquo;.</p>
+</li>
+</ol>
+</div>
+<p>If the format of the string matches one of the built in formats then a conversion to a java.sql.Time matches that of a SQL TIME value with value hh:mm:ss.</p>
+<p>If the string does not match any of the built in formats Derby attempts to use the Java locale specific parser to interpret the string as a date.</p>
+<a name="N101FD"></a><a name="Derby+SQL+TIMESTAMP"></a>
+<h3 class="boxed">Derby SQL TIMESTAMP</h3>
+<p>Derby&rsquo;s SQL TIMESTAMP type represents a time of day in the form yyyy-mm-dd hh:mm:ss.fffffffff (nanosecond granularity) with no associated time zone information.</p>
+<a name="N10203"></a><a name="java.sql.Timestamp"></a>
+<h4>java.sql.Timestamp</h4>
+<p>A JDBC Timestamp (java.sql.Timestamp) by definition represents a point in time, with nanosecond resolution, in a given time zone.</p>
+<a name="N10209"></a><a name="Conversion+of+a+JDBC+java.sql.Timestamp+to+a+Derby+TIMESTAMP+value"></a>
+<h4>Conversion of a JDBC java.sql.Timestamp to a Derby TIMESTAMP value</h4>
+<ol>
+<li>
+<p>setTimestamp() without a Calendar object or passing null for a Calendar object</p>
+<ul>
+<li>
+<p>The year, month, day, hour, minute, and second values will be calculated from the milli-seconds value of the java.sql.Timestamp instance using a Calendar object set to the time zone of the virtual machine. The nanosecond value will be calculated from the nanoseconds value of the java.sql.Timestamp.</p>
+</li>
+<li>
+<p>The timestamp component values will match the output of java.sql.Timestamp.toString().</p>
+</li>
+</ul>
+</li>
+<li>
+<p>setTime() with a Calendar object</p>
+<ul>
+<li>
+<p>The year, month, day, hour, minute, and second values will be calculated from the milliseconds value of the java.sql.Date instance using the passed in Calendar. The nanosecond value will be calculated from the nanoseconds value of the java.sql.Timestamp.</p>
+</li>
+<li>
+<p>The code for this is<br>cal.setTimeInMillis(value.getTime());<br>year = cal.get(Calendar.YEAR);<br>month = cal.get(Calendar.MONTH) + 1;<br>day = cal.get(Calendar.DAY_OF_MONTH);<br>hour = cal.get(Calendar.HOUR);<br>minute = cal.get(Calendar.MINUTE);<br>second = cal.get(Calendar.SECOND);<br>nanos = value.getNanos();</p>
+</li>
+<li>
+<p>This stored timestamp component value may not match the output of java.sql.Timestamp.toString() for the value, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<a name="N10235"></a><a name="Conversion+of+a+Derby+TIMESTAMP+value+to+a+JDBC+java.sql.Timestamp"></a>
+<h4>Conversion of a Derby TIMESTAMP value to a JDBC java.sql.Timestamp</h4>
+<ol>
+<li>
+<p>getTimestamp() without a Calendar object or passing null for a Calendar object</p>
+<ul>
+<li>
+<p>A java.sql.Timestamp instance is returned with a nanosecond value corresponding to yyyy-mm-dd hh:mm:ss.fffffffff according to the time zone of the java virtual machine</p>
+</li>
+<li>
+<p>The toString() method of the returned value will return &lsquo;yyyy-mm-dd hh:mm:ss.fffffffff&rsquo;.</p>
+</li>
+</ul>
+</li>
+<li>
+<p>getTime() with a Calendar object</p>
+<ul>
+<li>
+<p>A java.sql.Time instance is returned with a nanosecond value corresponding to yyyy-mm-dd hh:mm:ss.fffffffff according to the time zone of the Calendar</p>
+</li>
+<li>
+<p>The toString() method of the returned value may not return &lsquo;yyyy-mm-dd hh:mm:ss.fffffffff&rsquo;, since this method always uses the time zone of the virtual machine.</p>
+</li>
+</ul>
+</li>
+</ol>
+<a name="N1024E"></a><a name="Conversion+of+a+string+type+to+a+JDBC+java.sql.Timestamp"></a>
+<h4>Conversion of a string type to a JDBC java.sql.Timestamp</h4>
+<p>Two different timestamp formats are built into Derby:</p>
+<div style="margin-left: 2em">
+<ol>
+<li>
+<p>(ISO) yyyy-mm-dd hh:mm:ss[.ffffff]e.g. &ldquo;1980-10-25 13:01:23.123456&rdquo;, and</p>
+</li>
+<li>
+<p>(IBM) yyyy-mm-dd-hh.mm.ss[.ffffff]e.g. &ldquo;1980-10-25-13.01.23.123456&rdquo;.</p>
+</li>
+</ol>
+</div>
+<p>Note that only microsecond resolution is supported in converting strings to timestamps.</p>
+<p>If the format of the string matches one of the built in formats then a conversion to a java.sql.Timestamp matches that of a SQL TIMESTAMP value with value yyyy-mm-dd hh:mm:ss.ffffff.</p>
+<p>If the string does not match any of the built in formats Derby attempts to use the Java locale specific parser to interpret the string as a date.</p>
+<p>
+<em>Last Updated: November 8, 2005</em>
+</p>
+</div>
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+        Copyright &copy;
+         2004-2012 Apache Software Foundation</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:derby-user@db.apache.org?subject=Feedback%C2%A0papers/JDBCImplementation.html">derby-user@db.apache.org</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>