root/XerialJ/trunk/sqlite-jdbc/sqlitejdbc/README

Revision 2260, 3.3 kB (checked in by leo, 4 years ago)

merged from branch

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date Rev LastChangedBy URL Author
Line 
1---------------------------------------------------------------------
2What:  SQLite 3.3.x JDBC Driver
3Who:   David Crawshaw <david@zentus.com>
4When:  2006
5Why:   Because Derby is bloated, HSQLDB has too many capital letters
6       in its name and I don't have the time to maintain a full Java
7       port of SQLite.
8How:   BSD License (dig in)
9---------------------------------------------------------------------
10
11
12-- USING ------------------------------------------------------------
13This driver comes in two flavours: Pure Java and native library. The
14Pure Java driver works by running a MIPS version of SQLite inside the
15JVM with NestedVM. To use, download sqlitejdbc-*version*-nested.tgz,
16extract sqlitejdbc-*version*-nested.jar and include in the classpath
17of your project. You can then invoke SQLite using the standard JDBC
18interface:
19
20    Class.forName("org.sqlite.JDBC");
21    Connection conn = DriverManager.getConnection(
22        "jdbc:sqlite:filename");
23    // ... use the database ...
24    conn.close();
25
26The native library version is faster, but requires a platform and
27operating system specific binary. Place the file
28sqlitejdbc-*version*-native.jar on the classpath and the native
29library sqlitejdbc.dll or libsqlitejdbc.jnilib on the Java library
30path. To do this from the command line:
31
32    java -cp sqlitejdbc.jar -Djava.library.path=. yourprog.Main
33
34Alternatively, if you wish to load the native library at runtime,
35set the system property "org.sqlite.lib.path" to the directory
36containing the library. For bundling several binaries, the property
37"org.sqlite.lib.name" can be used if the path property is set. This
38is used as the name of the native library to load.
39
40For a memory database, use a URL without a file name:
41    Connection conn = DriverManager.getConnection("jdbc:sqlite:");
42
43
44-- NOT YET IMPLEMENTED ----------------------------------------------
45Most aspects of JDBC that are unsupported are done so because SQLite
46doesn't lend itself that way, or I haven't got around to it yet.
47
48- getBlob() / setBlob(): these functions require constantly creating
49  instances of java.sql.Blob, which I do not like. The features of
50  these functions, such as Stream access cannot be implemented
51  efficiently on SQLite anyhow. The only thing that is important is
52  retrieving the length of a blob without reading the contents into
53  memory. I hope to provide non-JDBC access to this through the API
54  mentioned for user-defined functions.
55- ResultSet.isLast(): the only truly evil function in the JDBC spec.
56  Even the JavaDoc's accept this:
57     Calling the method isLast may be expensive because the JDBC
58     driver might need to fetch ahead one row in order to determine
59     whether the current row is the last row in the result set.
60
61  Supporting this function would bring all the pain of determining
62  types, terribly bloat the code and mean a performance hit. It
63  will probably always throw an SQLException. Use next() instead.
64
65
66-- COMPILING --------------------------------------------------------
67Install gcc, gnu make, a JDK, set your $JAVA_HOME and type:
68    $ make
69
70On a Unix system, this should compile the driver for your
71architecture and run the test suite. On cygwin you may be lucky and
72only have to rename libsqlitejdbc.so to sqlitejdbc.dll, or other
73problems may appear.
74
75To pass the tests an sqlite binary is needed on the path.
Note: See TracBrowser for help on using the browser.