Debian Codegraph @

lang/sql/jdbc/doc/overview-summary.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.4.2_03) on Thu Feb 09 06:54:00 CET 2012 -->
6 <TITLE>
7 Overview (SQLite Java Wrapper)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="Overview, SQLite Java Wrapper/JDBC Driver
11 <br><small>
12 2012-02-09
13 </small>">
14
15 <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
16
17 <SCRIPT type="text/javascript">
18 function windowTitle()
19 {
20 parent.document.title="Overview (SQLite Java Wrapper)";
21 }
22 </SCRIPT>
23
24 </HEAD>
25
26 <BODY BGCOLOR="white" onload="windowTitle();">
27
28
29 <!-- ========= START OF TOP NAVBAR ======= -->
30 <A NAME="navbar_top"><!-- --></A>
31 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
32 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
33 <TR>
34 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
35 <A NAME="navbar_top_firstrow"><!-- --></A>
36 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
37 <TR ALIGN="center" VALIGN="top">
38 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT>&nbsp;</TD>
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
42 </TR>
43 </TABLE>
44 </TD>
45 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
46 </EM>
47 </TD>
48 </TR>
49
50 <TR>
51 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
52 &nbsp;PREV&nbsp;
53 &nbsp;NEXT</FONT></TD>
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
55 <A HREF="index.html" target="_top"><B>FRAMES</B></A> &nbsp;
56 &nbsp;<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
57 &nbsp;<SCRIPT type="text/javascript">
58 <!--
59 if(window==top) {
60 document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
61 }
62 //-->
63 </SCRIPT>
64 <NOSCRIPT>
65 <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
66 </NOSCRIPT>
67
68 </FONT></TD>
69 </TR>
70 </TABLE>
71 <A NAME="skip-navbar_top"></A>
72 <!-- ========= END OF TOP NAVBAR ========= -->
73
74 <HR>
75 <CENTER>
76 <H1>
77 SQLite Java Wrapper/JDBC Driver
78 <br><small>
79 2012-02-09
80 </small>
81 </H1>
82 </CENTER>
83 <A NAME="overview_description">
84 This is a Java wrapper including a basic JDBC driver
85 for the <A HREF="http://www.sqlite.org" TARGET="_blank">
86 SQLite 2/3 database engine</A>.
87 <P>
88 <B>See:</B>
89 <BR>
90 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#overview_description"><B>Description</B></A>
91 <P>
92
93 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
94 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
95 <TD COLSPAN=2><FONT SIZE="+2">
96 <B>Packages</B></FONT></TD>
97 </TR>
98 <TR BGCOLOR="white" CLASS="TableRowColor">
99 <TD WIDTH="20%"><B><A HREF="SQLite/package-summary.html">SQLite</A></B></TD>
100 <TD>&nbsp;</TD>
101 </TR>
102 </TABLE>
103
104 <P>
105 &nbsp;<A NAME="overview_description"><!-- --></A>
106 <P>
107 <A NAME="overview_description">
108 This is a Java wrapper including a basic JDBC driver
109 for the <A HREF="http://www.sqlite.org" TARGET="_blank">
110 SQLite 2/3 database engine</A>.
111 It is designed using JNI to interface to the SQLite API. That
112 API is wrapped by methods in the <A HREF="SQLite/Database.html">
113 SQLite.Database</A> class.
114 Since June, 2002, it includes a small <A HREF="#jdbc_driver">JDBC driver</A>,
115 which allows the most basic things to be carried out using the
116 <TT>java.sql</TT> package.
117 Since September, 2004, SQLite3 (minimum 3.0.7) is supported. The JNI part can
118 be generated to include support for both SQLite 2.x and 3.x and detects at
119 runtime the type of the database.
120 <P>
121 The current source tarball can be downloaded from
122 <A HREF="http://www.ch-werner.de/javasqlite/javasqlite-20120209.tar.gz">
123 javasqlite-20120209.tar.gz</A>.
124 It has been tested on Linux, using SQLite 2.8.17 and 3.7.9,
125 and JDK 1.4/1.5/1.6 from
126 <A HREF="http://java.sun.com" TARGET="_blank">Sun</A>.
127 The change log starting from August 2007 is <A HREF="ChangeLog">here</A>.
128 <P>
129
130 For rebuilding the following requirements must be met:
131 <UL>
132 <LI TYPE="circle">SQLite 2.4.12 or higher
133 <LI TYPE="circle">JDK 1.1 or higher
134 <LI TYPE="circle">C compiler and make
135 </UL>
136 The source code uses GNU autoconf, thus the build process on UN*X like
137 systems should look like:
138 <P>
139 <PRE>
140 $ ./configure
141 ...
142 $ make
143 ...
144 $ su -c "make install"
145 ...
146 </PRE>
147 <P>
148 To override the directory where configure looks for SQLite and JDK the
149 configure options <TT>--with-sqlite=DIR</TT>, <TT>--with-sqlite3=DIR</TT>,
150 and <TT>--with-jdk=DIR</TT> can be used. To specify the place where the
151 native library (the <TT>libsqlite_jni.so</TT> file) shall be
152 installed, use the <TT>--prefix=DIR</TT> option. The default place is
153 <TT>/usr/local/lib</TT>, i.e. the prefix defaults to <TT>/usr/local</TT>.
154 To specify where the <TT>sqlite.jar</TT> file containing the high-level
155 part and the JDBC driver shall be
156 installed, use the <TT>--with-jardir=DIR</TT> option. The default is
157 <TT>/usr/local/share/java</TT>.
158 At runtime, it is necessary to tell the JVM both places with
159 the <TT>-classpath</TT> and <TT>-Djava.library.path=..</TT>
160 command line options. Optionally, the native part is searched
161 using the path prefix specified in the <TT>-DSQLite.library.path=..</TT>
162 property, which has precedence over <TT>-Djava.library.path=..</TT>.
163 <P>
164 For Win32 (NT4 or above) the makefiles <TT>javasqlite.mak</TT>,
165 <TT>javasqlite23.mak</TT>, and <TT>javasqlite3.mak</TT> are provided
166 in the source archive. These makefiles contain some build
167 instructions and use the J2SE 1.4.2 from Sun and MS Visual C++ 6.0.
168 <P>
169 A DLL with the native JNI part (including SQLite 3.7.7.1)
170 and the JAR file with the Java part can be downloaded from
171 <A HREF="http://www.ch-werner.de/javasqlite/javasqlite-20110827-win32.zip">
172 javasqlite-20110827-win32.zip</A>.
173 <P>
174 After successful build and installation a small
175 <A HREF="test.java">test program</A> can be run by invoking the
176 following commands (on OJEC replace the <TT>java</TT> command by
177 <TT>cvm</TT>):
178 <P>
179 <PRE>
180 $ make test
181 ...
182 $ java -classpath ... -Djava.library.path=... test
183 version: 2.8.17
184 ==== local callback ====
185 #cols = 5
186 col0: type
187 col1: name
188 ...
189 </PRE>
190 <P>
191 For testing the newer features of SQLite3 (parameter binding with
192 the help of the <A HREF="SQLite/Stmt.html">SQLite.Stmt</A> class
193 and incremental blob I/O through <A HREF="SQLite/Blob.html">SQLite.Blob</A>
194 class) refer to another <A HREF="test3.java">test program</A>.
195 <P>
196 A simple shell modelled after that of SQLite can be invoked as
197 (on OJEC replace the <TT>java</TT> command by <TT>cvm</TT>):
198 <PRE>
199 $ java SQLite.Shell [options] database [sql string]
200 </PRE>
201 or using the JAR file
202 <PRE>
203 $ java -jar sqlite.jar [options] database [sql string]
204 </PRE>
205 <P>
206 The native part of the Java SQLite wrapper takes the compile-time
207 character encoding of the SQLite engine into account, and tries to
208 map the Java unicode string representation into the system encoding
209 and vice versa when SQLite has not been built with UTF-8 support.
210 This can be overriden programatically or by specifying the
211 <TT>-DSQLite.encoding=x</TT> command line option to the Java
212 runtime, where <TT>x</TT> must be a charset name recognized
213 by your Java environment. If the SQLite engine supports UTF-8,
214 no special options are needed.
215 <P>
216 <A NAME="jdbc_driver">
217 If you like to try the JDBC driver, use <TT>SQLite.JDBCDriver</TT>
218 as the JDBC drivers's class name. Make sure that you have the
219 <TT>sqlite.jar</TT> in your class path and the native
220 library in your java library path. The JDBC URLs to connect to
221 an SQLite database have the format <TT>jdbc:sqlite:/path</TT>,
222 where <TT>path</TT> has to be specified as the path
223 name to the SQLite database, for example
224 <PRE>
225 jdbc:sqlite://dirA/dirB/dbfile
226 jdbc:sqlite:/DRIVE:/dirA/dirB/dbfile
227 jdbc:sqlite:///COMPUTERNAME/shareA/dirB/dbfile
228 </PRE>
229 In order to deal with SQLite's in-memory databases, use a
230 JDBC URL with this format:
231 <PRE>
232 jdbc:sqlite:/:memory:
233 </PRE>
234 For now, the only data types
235 supported on SQLite tables are <TT>java.lang.String</TT>,
236 <TT>short</TT>, <TT>int</TT>, <TT>float</TT>, and <TT>double</TT>.
237
238 The encoding of SQLite2 databases can be set per
239 JDBC connection using the connect property <TT>encoding</TT>
240 when creating the connection.
241
242 Partial support exists for <TT>java.sql.Date</TT>,
243 <TT>java.sql.Time</TT>, and <TT>java.sql.Timestamp</TT>.
244 For SQLite3 engines the connect property <TT>daterepr</TT>
245 determines, how date/time/timestamp data is interpreted.
246 If set to <TT>daterepr=julian</TT>, on INSERT/UPDATE these
247 datatypes are converted to a floating point number
248 expressing a julian day number as described in the
249 <A href="http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions" TARGET="_blank">
250 SQLite Wiki</A>. On retrieval (SELECT), the floating point
251 representation is preferred. All other values of the <TT>daterepr</TT>
252 property use the string formats <TT>YYYY-mm-dd</TT> for date,
253 <TT>HH:MM:SS</TT> for time, and <TT>YYYY-mm-dd HH:MM:SS.f</TT>
254 for timestamp.
255
256 The data type mapping depends mostly on the availability of
257 the SQLite <TT>PRAGMAs</TT> <TT>show_datatypes</TT> and <TT>table_info</TT>.
258 Most basic database meta data methods are implemented,
259 thus enough information is available to access SQLite
260 databases with JDK >= 1.3 and the
261 <A HREF="http://www.isqlviewer.com" TARGET="_blank">ISQLViewer</A>
262 tool.
263 <P>
264 A JDBC based benchmark program is built into <TT>sqlite.jar</TT>.
265 If using a non OJEC version of Java it can be invoked by
266 <PRE>
267 $ java -cp sqlite.jar SQLite.BenchmarkDriver ...
268 </PRE>
269 If using an OJEC version of Java it can be invoked by
270 <PRE>
271 $ cvm -cp sqlite.jar SQLite.BenchmarkDataSource ...
272 </PRE>
273 For further details see the usage information when invoked without
274 arguments and consult the source code.
275 <P>
276 Other useful information to make this package work on
277 ARM Linux can be found in
278 <A HREF="http://www.kecher.de/howtos/SQLite-JDBC-Howto.html" TARGET="_blank">
279 How To compile SQLite with JDBC for the iPAQ</A>.
280 <P>
281 Tim Anderson has some notes on compiling in his
282 <A HREF="http://www.itwriting.com/sqlitenotes.php" TARGET="_blank">sqlitenotes</A>.
283 <P>
284 Stanislaw Ciszewski had also success on MacOSX, see his
285 <A HREF="scnotes.txt">remarks here</A>.
286 <P>
287 Anton Johansson wrote a <A HREF="ajhowto.txt">howto</A> compile
288 SQLite Java Wrapper for Windows, thanks Anton!
289 <P>
290 To find out the SQLite.Database instance of a JDBC connection,
291 that code snippet can serve as a starting point:
292 <PRE>
293 Connection conn = null;
294 SQLite.Database db = null;
295 try {
296 Class.forName("SQLite.JDBCDriver").newInstance();
297 conn = DriverManager.getConnection("jdbc:sqlite:/blabla");
298 java.lang.reflect.Method m =
299 conn.getClass().getMethod("getSQLiteDatabase", null);
300 db = (SQLite.Database) m.invoke(conn, null);
301 } catch (Exception e) {
302 }
303 </PRE>
304 <P>
305 This software and accompanying documentation is released under
306 a BSD-style license:
307 <P>
308 <TABLE ALIGN="center"BORDER="0" CELLPADDING="0" CELLSPACING="3">
309 <TR><TD BGCOLOR="EEEEEE">
310 <PRE>
311 This software is copyrighted by Christian Werner &lt;[email protected]&gt;
312 and others. The following terms apply to all files associated with the
313 software unless explicitly disclaimed in individual files.
314
315 The authors hereby grant permission to use, copy, modify, distribute,
316 and license this software and its documentation for any purpose, provided
317 that existing copyright notices are retained in all copies and that this
318 notice is included verbatim in any distributions. No written agreement,
319 license, or royalty fee is required for any of the authorized uses.
320 Modifications to this software may be copyrighted by their authors
321 and need not follow the licensing terms described here, provided that
322 the new terms are clearly indicated on the first page of each file where
323 they apply.
324
325 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
326 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
327 ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
328 DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
329 POSSIBILITY OF SUCH DAMAGE.
330
331 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
332 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
333 FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
334 IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
335 NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
336 MODIFICATIONS.
337 </PRE>
338 </TD></TR>
339 </TABLE>
340 <P>
341
342 <P>
343 <HR>
344
345
346 <!-- ======= START OF BOTTOM NAVBAR ====== -->
347 <A NAME="navbar_bottom"><!-- --></A>
348 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
349 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
350 <TR>
351 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
352 <A NAME="navbar_bottom_firstrow"><!-- --></A>
353 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
354 <TR ALIGN="center" VALIGN="top">
355 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT>&nbsp;</TD>
356 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD>
357 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
358 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
359 </TR>
360 </TABLE>
361 </TD>
362 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
363 </EM>
364 </TD>
365 </TR>
366
367 <TR>
368 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
369 &nbsp;PREV&nbsp;
370 &nbsp;NEXT</FONT></TD>
371 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
372 <A HREF="index.html" target="_top"><B>FRAMES</B></A> &nbsp;
373 &nbsp;<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
374 &nbsp;<SCRIPT type="text/javascript">
375 <!--
376 if(window==top) {
377 document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
378 }
379 //-->
380 </SCRIPT>
381 <NOSCRIPT>
382 <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
383 </NOSCRIPT>
384
385 </FONT></TD>
386 </TR>
387 </TABLE>
388 <A NAME="skip-navbar_bottom"></A>
389 <!-- ======== END OF BOTTOM NAVBAR ======= -->
390
391 <HR>
392 <small>Contact: <a HREF="mailto:[email protected]">Christian Werner</a></small>
393 </BODY>
394 </HTML>