Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > 636b2a8b77acacd6717dd7e72eda4c1d > files > 52

db6.1-java-devel-6.1.29.0-1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Closing Database Environments</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with Berkeley DB" />
    <link rel="up" href="Env.html" title="Chapter 2. Database Environments" />
    <link rel="prev" href="Env.html" title="Chapter 2. Database Environments" />
    <link rel="next" href="EnvProps.html" title="Environment Properties" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.1</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Closing Database Environments</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="Env.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 2. Database Environments</th>
          <td width="20%" align="right"> <a accesskey="n" href="EnvProps.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="EnvClose"></a>Closing Database Environments</h2>
          </div>
        </div>
      </div>
      <p>
    You close your environment by calling the 
    <code class="methodname">Environment.close()</code>
    method. This method performs a checkpoint, so it is not necessary to perform a sync or a checkpoint explicitly
    before calling it. For information on checkpoints, see the
    <em class="citetitle">Berkeley DB, Java Edition Getting Started with Transaction Processing</em> guide.
    For information on syncs, see 
    
    
    <span>
    the <em class="citetitle">Getting Started with Transaction Processing for Java</em> guide.
    </span>
    </p>
      <pre class="programlisting">import com.sleepycat.db.DatabaseException;

import com.sleepycat.db.Environment;

...

try {
    if (myDbEnvironment != null) {
        myDbEnvironment.close();
    } 
} catch (DatabaseException dbe) {
    // Exception handling goes here
} </pre>
      <p>You should close your environment(s) only after all other
    database activities have completed. It is recommended that you close any databases
    currently open in the environment prior to closing the environment.</p>
      <p>
    Closing the last environment handle in your application causes all
    internal data structures to be 
    
    <span>
            released.
    </span>
    
    
    
    If there are any opened databases or stores, 
    then DB will complain before closing them as well. 
    At this time, any open cursors are also closed, and any on-going transactions are aborted. However, it is recommended that you always close all cursor handles immediately after their use to ensure concurrency and to release resources such as page locks. 
    </p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="Env.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="Env.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="EnvProps.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Chapter 2. Database Environments </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Environment Properties</td>
        </tr>
      </table>
    </div>
  </body>
</html>