1<!--$Id: java.so,v 1.21 2006/08/24 16:32:33 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Release 4.2: Java</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></b></td> 13<td align=right><a href="/upgrade.4.2/intro.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.4.2/queue.html"><img src="/images/next.gif" alt="Next"></a> 14</td></tr></table> 15<p align=center><b>Release 4.2: Java</b></p> 16<p>There are a number of major changes to the Java support in Berkeley DB in this 17release. Despite that we have tried to make this a bridge release, a 18release where we don't require you to change anything. We've done this 19using the standard approach to deprecation in Java. If you do not 20compile with deprecation warnings on, your existing sources should work 21with this new release with only minor changes despite the large number 22of changes. Expect that in a future release we will remove all the 23deprecated API and only support the new API names.</p> 24<p>This is a list of areas where we have broken compatibility with the 254.1 release. In most cases it is a name change in an interface class. 26</p> 27<p><ul type=disc> 28<li><b>DbAppDispatch.app_dispatch(DbEnv,Dbt,DbLsn,int)</b><p>is now: 29<b>DbAppDispatch.appDispatch(DbEnv,Dbt,DbLsn,int)</b></p> 30<li><b>DbAppendRecno.db_append_recno(Db,Dbt,int)</b><p>is now: 31<b>DbAppendRecno.dbAppendRecno(Db,Dbt,int)</b></p> 32<li><b>DbBtreeCompare.bt_compare(Db,Dbt,Dbt)</b><p>is now: 33<b>DbBtreeCompare.compare(Db,Dbt,Dbt)</b></p> 34<li><b>DbBtreeCompare.dup_compare(Db,Dbt,Dbt)</b><p>is now: 35<b>DbBtreeCompare.compareDuplicates(Db,Dbt,Dbt)</b></p> 36<li><b>DbBtreePrefix.bt_prefix(Db,Dbt,Dbt)</b><p>is now: 37<b>DbBtreePrefix.prefix(Db,Dbt,Dbt)</b></p> 38<li><b>DbSecondaryKeyCreate.secondary_key_create(Db,Dbt,Dbt,Dbt)</b><p>is now: 39<b>DbSecondaryKeyCreate.secondaryKeyCreate(Db,Dbt,Dbt,Dbt)</b></p> 40</ul> 41<p>The 4.2 release of Berkeley DB requires at minimum a J2SE 1.3.1 certified Java 42virtual machine and associated classes to properly build and execute. 43To determine what version virtual machine you are running, enter:</p> 44<blockquote><pre>java -version</pre></blockquote> 45<p>at a command line and look for the version number. If you need to 46deploy to a version 1.1 or 1.0 Java environment, it may be possible to 47do so by not including the classes in the com.sleepycat.bdb package 48in the Java build process (however, that workaround has not been tested 49by us).</p> 50<p>A few inconsistent methods have been cleaned up (for example, Db.close 51now returns void; previously, it returned an int which was always zero). 52The synchronized attributed has been toggled on some methods -- this is 53an attempt to prevent multithreaded applications from calling close or 54similar methods concurrently from multiple threads.</p> 55<p>The Berkeley DB API has up until now been consistent across all language APIs. 56Although consistency has is benefits, it made our Java API look strange to 57Java programmers. Many methods have been renamed in this release of the 58Java API to conform with Java naming conventions. Sometimes this renaming 59was simply "camel casing", sometimes it required rewording. The mapping 60file for these name changes is in <b>dist/camel.pm</b>. The Perl script 61we use to convert code to the new names is called 62<b>dist/camelize.pl</b>, and may help with updating Java applications 63written for earlier versions of Berkeley DB.</p> 64<p>Berkeley DB has a number of places where as a C library it uses function pointers 65to move into custom code for the purpose of notification of some event. In 66Java the best parallel is the registration of some class which implements 67an interface. In this version of Berkeley DB we have made an effort to make those 68interfaces more uniform and predictable. Specifically, DbEnvFeedback is now 69DbEnvFeedbackHandler, DbErrcall is DbErrorHandler and DbFeedback is 70DbFeedbackHandler. In every case we have kept the older interfaces and the 71older registration methods so as to allow for backward compatibility in this 72release. Expect them to be removed in future releases.</p> 73<p>As you upgrade to this release of Berkeley DB you will notice that we have 74added an entirely new layer inside the package com.sleepycat.bdb. This 75was formerly the Greybird project by Mark Hayes. Sleepycat Software and 76Mark worked together to incorporate his work. We have done this in 77hopes of reducing the learning curve when using Berkeley DB in a Java project. 78When you upgrade you should consider switching to this layer as over 79time the historical classes and the new bdb package classes will be more 80and more integrated providing a simple yet powerful interface from Java 81into the Berkeley DB library.</p> 82<p>Berkeley DB's Java API is now generated with <a href="http://www.swig.org">SWIG</a>. 83The new Java API is significantly faster for many operations.</p> 84<p>Some internal methods and constructors that were previously public have 85been hidden or removed.</p> 86<p>Packages found under com.sleepycat are considered different APIs into 87the Berkeley DB system. These include the core db api (com.sleepycat.db), the 88collections style access layer (com.sleepycat.bdb) and the now relocated XA 89system (com.sleepycat.xa).</p> 90<table width="100%"><tr><td><br></td><td align=right><a href="/upgrade.4.2/intro.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.4.2/queue.html"><img src="/images/next.gif" alt="Next"></a> 91</td></tr></table> 92<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 93</body> 94</html> 95