diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-02-17 17:25:57 +0000 |
|---|---|---|
| committer | <> | 2015-03-17 16:26:24 +0000 |
| commit | 780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch) | |
| tree | 598f8b9fa431b228d29897e798de4ac0c1d3d970 /docs/installation/build_android_jdbc.html | |
| parent | 7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff) | |
| download | berkeleydb-master.tar.gz | |
Diffstat (limited to 'docs/installation/build_android_jdbc.html')
| -rw-r--r-- | docs/installation/build_android_jdbc.html | 229 |
1 files changed, 136 insertions, 93 deletions
diff --git a/docs/installation/build_android_jdbc.html b/docs/installation/build_android_jdbc.html index 11d31974..9ab30ca5 100644 --- a/docs/installation/build_android_jdbc.html +++ b/docs/installation/build_android_jdbc.html @@ -14,15 +14,17 @@ <body> <div xmlns="" class="navheader"> <div class="libver"> - <p>Library Version 11.2.5.3</p> + <p>Library Version 12.1.6.1</p> </div> <table width="100%" summary="Navigation header"> <tr> - <th colspan="3" align="center">Building the Android JDBC Driver</th> + <th colspan="3" align="center">Building the Android JDBC + Driver</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="build_android_intro.html">Prev</a> </td> - <th width="60%" align="center">Chapter 4. Building Berkeley DB for Android</th> + <th width="60%" align="center">Chapter 4. Building Berkeley DB for + Android</th> <td width="20%" align="right"> <a accesskey="n" href="build_android_config.html">Next</a></td> </tr> </table> @@ -32,32 +34,40 @@ <div class="titlepage"> <div> <div> - <h2 class="title" style="clear: both"><a id="build_android_jdbc"></a>Building the Android JDBC Driver</h2> + <h2 class="title" style="clear: both"><a id="build_android_jdbc"></a>Building the Android JDBC + Driver</h2> </div> </div> </div> <p> - This section describes how to build and use the BDB JDBC driver - for Android. Note that the BDB JDBC driver cannot currently be - built on a Windows platform. + The JDBC API is an alternative to the drop-in replacement. + It is possible to build Berkeley DB SQL for Android in such a + way that a JDBC API is exposed to Android application + developers. This is done using the Android NDK. + </p> + <p> + This section describes how to build and use the BDB JDBC + driver for Android. Note that the BDB JDBC driver cannot + currently be built on a Windows platform. </p> <div class="orderedlist"> <ol type="1"> <li> - <p> - Download and install the Android SDK. The installation - instructions can be found here: + <p> + Download and install the Android SDK. The + installation instructions can be found here: </p> <p> - <a class="ulink" href="http://developer.android.com/sdk/installing.html" target="_top">http://developer.android.com/sdk/installing.html</a> + <a class="ulink" href="http://developer.android.com/sdk/installing/index.html" target="_top">http://developer.android.com/sdk/installing/index.html</a> </p> </li> <li> <p> - Download and install the Android NDK. It can be found here: + Download and install the Android NDK. It can be + found here: </p> <p> - <a class="ulink" href="http://developer.android.com/sdk/ndk/index.html" target="_top">http://developer.android.com/sdk/ndk/index.html</a> + <a class="ulink" href="http://developer.android.com/tools/sdk/ndk/index.html" target="_top">http://developer.android.com/tools/sdk/ndk/index.html</a> </p> </li> <li> @@ -72,56 +82,56 @@ Berkeley DB package from here: </p> <p> - <a class="ulink" href="http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html" target="_top">http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html</a> + <a class="ulink" href="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html" target="_top">http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html</a> </p> <p> - Note that you must be using a 5.3.x or higher - version of the product in order for these - instructions to work. Once you have the package, - unpack it: + Note that you must be using a 5.3.x or + higher version of the product in order for + these instructions to work. Once you have the + package, unpack it: </p> <pre class="programlisting">$ tar zxvf db-x.y.z.tar.gz $ cd db-x.y.z</pre> - <p> - Where <code class="literal">x.y.z</code> the major, minor, - and point release version of the Berkeley DB - distribution which you are using. + <p> + Where <code class="literal">x.y.z</code> the major, + minor, and point release version of the + Berkeley DB distribution which you are using. </p> <p> - Also, note that in the following instructions, the - directory denoted by <code class="literal">db-x.y.z</code>, - above, is referred to as - <code class="literal"><db></code>. + Also, note that in the following + instructions, the directory denoted by + <code class="literal">db-x.y.z</code>, above, is + referred to as <code class="literal"><db></code>. </p> </li> <li> - <p> - Build an x86/x64 JDBC package. This is required - because the building process will generate target - files which are required to build Android NDK. - Also, the built JAR file can be imported by - eclipse, which will then convert it to the Android - Dalvik JAR format. + <p> + Build an x86/x64 JDBC package. This is + required because the building process will + generate target files which are required to + build Android NDK. Also, the built JAR file + can be imported by eclipse, which will then + convert it to the Android Dalvik JAR format. </p> - <p> + <p> To do this, edit - <code class="literal"><db>/lang/sql/jdbc/SQLit/Database.java</code> + <code class="literal"><db>/lang/sql/jdbc/SQLit/Database.java</code> and replace all instances of - <code class="literal">System.loadLibrary("sqlite_jni")</code> + <code class="literal">System.loadLibrary("sqlite_jni")</code> with - <code class="literal">System.loadLibrary("oracle-jdbc")</code>. + <code class="literal">System.loadLibrary("oracle-jdbc")</code>. </p> <p> - Once you have done this, configure and make the - library. The following example shows the minimum - configuration options that you need to use in order - to configure the Berkeley DB JDBC driver. For your - particular installation, other configuration - options might be interesting to you. See - <a class="xref" href="build_unix_conf.html" title="Configuring Berkeley DB">Configuring Berkeley DB</a> - and - <a class="xref" href="build_android_config.html" title="Android Configuration Options">Android Configuration Options</a> - for more information. + Once you have done this, configure and make + the library. The following example shows the + minimum configuration options that you need to + use in order to configure the Berkeley DB JDBC + driver. For your particular installation, + other configuration options might be + interesting to you. See <a class="xref" href="build_unix_conf.html" title="Configuring Berkeley DB">Configuring Berkeley DB</a> and + <a class="xref" href="build_android_config.html" title="Android Configuration Options">Android Configuration + Options</a> for + more information. </p> <pre class="programlisting">cd <db>/build_unix ../dist/configure --enable-jdbc && make</pre> @@ -130,8 +140,36 @@ $ cd db-x.y.z</pre> </div> </li> <li> + <p> + Enable encryption if required. + </p> + <p> + By default, encryption is disabled. To enable it, + edit + <code class="literal"><db>/build_android/jdbc/jni/Android.mk</code> + and change <code class="literal">BDB_ENABLE_ENCRYPTION</code> + from <code class="literal">false</code> to + <code class="literal">true</code>. + </p> + <p> + After enabling encryption, use <code class="literal">pragma + key</code> to set the password. You must do + this before performing any database operations. For + example: + </p> + <pre class="programlisting"> # ./dbsql test.db +dbsql> pragma key="xyzzy"; +dbsql> create table t1(x); +dbsql> .quit + +# ./dbsql test.db +dbsql> pragma key="xyzzy"; +dbsql> .tables +t1 </pre> + </li> + <li> <p> - Build the Android NDK: + Build the Android NDK: </p> <pre class="programlisting">$ cd <db>/build_android/jdbc/jni $ <ndk-install-directory>/ndk-build </pre> @@ -152,29 +190,29 @@ $ <ndk-install-directory>/ndk-build </pre> </li> </ol> </div> - <p> - Having built the JDBC driver, you can now use it with your project. - You can do this using Eclipse and the ADT plugin, which you can get - from here: + <p> + Having built the JDBC driver, you can now use it with your + project. You can do this using Eclipse and the ADT plugin, + which you can get from here: </p> <p> - <a class="ulink" href="http://developer.android.com/sdk/eclipse-adt.html" target="_top">http://developer.android.com/sdk/eclipse-adt.html</a> + <a class="ulink" href="http://developer.android.com/tools/sdk/eclipse-adt.html" target="_top">http://developer.android.com/tools/sdk/eclipse-adt.html</a> </p> - <p> + <p> To make sure everything is working: </p> <div class="orderedlist"> <ol type="1"> <li> - <p> - Start Eclipse and create an Android project. Use: + <p> + Start Eclipse and create an Android project. Use: </p> <div class="itemizedlist"> <ul type="disc"> <li> <p> - <code class="literal">test_jdbc</code> as the Android project - name. + <code class="literal">test_jdbc</code> as the Android + project name. </p> </li> <li> @@ -183,18 +221,18 @@ $ <ndk-install-directory>/ndk-build </pre> </p> </li> <li> - <p> + <p> For the package name, use - <code class="literal">example.jdbc</code>. + <code class="literal">example.jdbc</code>. </p> </li> </ul> </div> </li> <li> - <p> - This results in an empty code file. Copy and paste the - following example code into that file: + <p> + This results in an empty code file. Copy and paste + the following example code into that file: </p> <pre class="programlisting">package example.testjdbc; @@ -285,8 +323,8 @@ public class Test_jdbcActivity extends Activity { } </pre> </li> <li> - <p> - Copy the following files into place: + <p> + Copy the following files into place: </p> <pre class="programlisting">$ cd <workspace>/test_jdbc $ mkdir -p libs/armeabi @@ -295,18 +333,16 @@ libs/armeabi $ cp -r <db>/build_unix/jdbc/sqlite.jar libs</pre> </li> <li> - <p> - Back in Eclipse, right click the project name, and select - the <code class="literal">refresh</code> option to reload the project - from the directory. The two new files that were copied into - place in the previous step are now included in the project - view. + <p> + Back in Eclipse, right click the project name, and + select the <code class="literal">refresh</code> option to reload + the project from the directory. The two new files that + were copied into place in the previous step are now + included in the project view. </p> </li> <li> - <p> - Convert the JAR file to the Android Dalvik format: - </p> + <p> Convert the JAR file to the Android Dalvik format: </p> <div class="orderedlist"> <ol type="a"> <li> @@ -316,7 +352,8 @@ $ cp -r <db>/build_unix/jdbc/sqlite.jar libs</pre> </li> <li> <p> - Choose <code class="literal">Build Path -> Configure Build Path</code> + Choose <code class="literal">Build Path -> Configure + Build Path</code> </p> </li> <li> @@ -325,39 +362,42 @@ $ cp -r <db>/build_unix/jdbc/sqlite.jar libs</pre> </p> </li> <li> - <p> - Click <code class="literal">Add JARS</code>. + <p> + Click <code class="literal">Add JARS</code>. </p> </li> </ol> </div> </li> <li> - <p> - Run the project: + <p> + Run the project: </p> <div class="orderedlist"> <ol type="a"> <li> <p> - Choose <code class="literal">Property -> Android</code> - and select any one of the usable build targets. + Choose <code class="literal">Property -> + Android</code> and select any one of + the usable build targets. </p> </li> <li> - <p> - Right click the project. Choose <code class="literal">Run As -> Android</code> + <p> + Right click the project. Choose + <code class="literal">Run As -> Android</code> </p> </li> </ol> </div> </li> <li> - <p> - Verify your installation. After a short pause (depending - on the speed of your system), the application logo is - displayed. Use the Android adb command line application to - make sure the application is running as expected: + <p> + Verify your installation. After a short pause + (depending on the speed of your system), the + application logo is displayed. Use the Android adb + command line application to make sure the application + is running as expected: </p> <pre class="programlisting">$ cd <android-sdk>/platform-tools $ ./adb logcat @@ -368,9 +408,9 @@ I/System.out( 539): French_Roast 8.99 I/System.out( 539): Espresso 9.99 I/System.out( 539): Colombian_Decaf 8.99 I/System.out( 539): French_Roast_Decaf 9.99</pre> - <p> + <p> You can also check if the database - (<code class="literal">example.db</code>) exists in the + (<code class="literal">example.db</code>) exists in the emulator: </p> <pre class="programlisting">$ ./adb shell ls /data/data/example.testjdbc @@ -378,7 +418,8 @@ example.db example.db-journal lib </pre> <p> - Finally, check the database using the BDB SQL shell: + Finally, check the database using the BDB SQL + shell: </p> <pre class="programlisting"> $ ./adb push <db>/build_android/jdbc/libs/armeabi/dbsql \ @@ -414,11 +455,13 @@ dbsql> .quit </pre> <td width="40%" align="right"> <a accesskey="n" href="build_android_config.html">Next</a></td> </tr> <tr> - <td width="40%" align="left" valign="top">Chapter 4. Building Berkeley DB for Android </td> + <td width="40%" align="left" valign="top">Chapter 4. Building Berkeley DB for + Android </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> - <td width="40%" align="right" valign="top"> Android Configuration Options</td> + <td width="40%" align="right" valign="top"> Android Configuration + Options</td> </tr> </table> </div> |
