<?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>Chapter 2. Transactional Application</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.62.4" />
<link rel="home" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
<link rel="up" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
<link rel="previous" href="permmessages.html" title="Permanent Message Handling" />
<link rel="next" href="simpleprogramlisting.html" title="Program Listing" />
</head>
<body>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 2. Transactional Application</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="permmessages.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="simpleprogramlisting.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="txnapp"></a>Chapter 2. Transactional Application</h2>
</div>
</div>
<div></div>
</div>
<div class="toc">
<p>
<b>Table of Contents</b>
</p>
<dl>
<dt>
<span class="sect1">
<a href="txnapp.html#appoverview">Application Overview</a>
</span>
</dt>
<dt>
<span class="sect1">
<a href="simpleprogramlisting.html">Program Listing</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#repconfiginfo_cxx">
Class: RepConfig
</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#simpletxnusage_java">Class: SimpleTxn</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#simpletxnmain_java">Method: SimpleTxn.main()</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#simpletxn_init_java">Method: SimpleTxn.init()</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#doloop_java">Method: SimpleTxn.doloop()</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="simpleprogramlisting.html#printstocks_c">
Method: SimpleTxn.printStocks()
</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>
In this chapter, we build a simple transaction-protected DB
application. Throughout the remainder of this book, we will add
replication to this example. We do this to underscore the concepts
that we are presenting in this book; the first being that you
should start with a working transactional program and then add
replication to it.
</p>
<p>
Note that this book assumes you already know how to write a
transaction-protected DB application, so we will not be
covering those concepts in this book. To learn how to write a
transaction-protected application, see the
<i class="citetitle">Berkeley DB Getting Started with Transaction Processing</i> guide.
</p>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="appoverview"></a>Application Overview</h2>
</div>
</div>
<div></div>
</div>
<p>
Our application maintains a stock market quotes database.
This database contains records whose key is the stock
market symbol and whose data is the stock's price.
</p>
<p>
The application operates by presenting you with a command
line prompt. You then enter the stock symbol and its value,
separated by a space. The application takes this
information, writes it to the database.
</p>
<p>
To see the contents of the database, simply press
<tt class="literal">return</tt> at the command prompt.
</p>
<p>
To quit the application, type 'quit' or 'exit' at the
command prompt.
</p>
<p>
For example, the following illustrates the application's
usage. In it, we use entirely fictitious stock market
symbols and price values.
</p>
<pre class="programlisting">> java db.simpletxn.SimpleTxn -h env_home_dir
QUOTESERVER> stock1 88
QUOTESERVER> stock2 .08
QUOTESERVER>
Symbol Price
====== =====
stock1 88
QUOTESERVER> stock1 88.9
QUOTESERVER>
Symbol Price
====== =====
stock1 88.9
stock2 .08
QUOTESERVER> quit
></pre>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="permmessages.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="index.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="simpleprogramlisting.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Permanent Message Handling </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Program Listing</td>
</tr>
</table>
</div>
</body>
</html>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez