| 1 | <html> |
|---|
| 2 | <head><title>SQLite JDBC Driver</title></head> |
|---|
| 3 | <link rel="stylesheet" type="text/css" href="/content.css" /> |
|---|
| 4 | <link rel="stylesheet" type="text/css" href="/javasource.css" /> |
|---|
| 5 | <body> |
|---|
| 6 | <table width="100%" border="0" cellspacing="0" cellpadding="5"> |
|---|
| 7 | <tr><td colspan="2"> |
|---|
| 8 | <h1>SQLiteJDBC</h1> |
|---|
| 9 | <div id="subheading">100% Pure Java</div> |
|---|
| 10 | </td></tr> |
|---|
| 11 | |
|---|
| 12 | <tr valign="top"> |
|---|
| 13 | <td width="65%" id="content"> |
|---|
| 14 | <p>A JDBC driver for SQLite. It comes in two flavours, a 100% Pure Java driver |
|---|
| 15 | based on <a href="http://nestedvm.ibex.org">NestedVM</a> or a native JNI |
|---|
| 16 | library. The pure java driver is compatible, you can follow the Java dream and |
|---|
| 17 | use it anywhere with no worries. The native driver is fast, and I recommend it |
|---|
| 18 | wherever possible. Binaries are provided for Windows and Mac OS X.</p> |
|---|
| 19 | |
|---|
| 20 | <h3>News</h3> |
|---|
| 21 | <ul class="mono"> |
|---|
| 22 | <li>2008-05-11: Version v047 released: major internal work |
|---|
| 23 | plugs a long standing memory leak.</li> |
|---|
| 24 | <li>2008-04-17: Version v044 released: minor bug fixes and |
|---|
| 25 | an upgrade to 3.5.8.</li> |
|---|
| 26 | <li>2008-03-16: Version v043 released: support for multiple |
|---|
| 27 | connections in the Pure Java version on Java 6.</li> |
|---|
| 28 | <li>2008-03-05: Version v042 released: switch to using the |
|---|
| 29 | amalgamation source, integrate FTS3 (full text search), and |
|---|
| 30 | bring back the pure java builds.</li> |
|---|
| 31 | <li>2008-03-05: Bring back the Linux binary.</li> |
|---|
| 32 | <li>2008-03-03: Version v041 released: possible data corruption |
|---|
| 33 | bug fix, |
|---|
| 34 | <a href="http://article.gmane.org/gmane.comp.db.sqlite.jdbc/579" |
|---|
| 35 | >details</a>.</li> |
|---|
| 36 | </ul> |
|---|
| 37 | |
|---|
| 38 | <h3>Getting Started</h3> |
|---|
| 39 | |
|---|
| 40 | <p>Read the <a href="usage.html">usage</a> page for some basic details. |
|---|
| 41 | The short story is:</p> |
|---|
| 42 | |
|---|
| 43 | <pre class="code"> |
|---|
| 44 | import java.sql.*; |
|---|
| 45 | |
|---|
| 46 | public class Test { |
|---|
| 47 | public static void main(String[] args) throws Exception { |
|---|
| 48 | Class.forName(<font id="StringLiteral">"org.sqlite.JDBC"</font>); |
|---|
| 49 | Connection conn = DriverManager.getConnection(<font id="StringLiteral">"jdbc:sqlite:test.db"</font>); |
|---|
| 50 | Statement stat = conn.createStatement(); |
|---|
| 51 | stat.executeUpdate(<font id="StringLiteral">"drop table if exists people;"</font>); |
|---|
| 52 | stat.executeUpdate(<font id="StringLiteral">"create table people (name, occupation);"</font>); |
|---|
| 53 | PreparedStatement prep = conn.prepareStatement( |
|---|
| 54 | <font id="StringLiteral">"insert into people values (?, ?);"</font>); |
|---|
| 55 | |
|---|
| 56 | prep.setString(1, <font id="StringLiteral">"Gandhi"</font>); |
|---|
| 57 | prep.setString(2, <font id="StringLiteral">"politics"</font>); |
|---|
| 58 | prep.addBatch(); |
|---|
| 59 | prep.setString(1, <font id="StringLiteral">"Turing"</font>); |
|---|
| 60 | prep.setString(2, <font id="StringLiteral">"computers"</font>); |
|---|
| 61 | prep.addBatch(); |
|---|
| 62 | prep.setString(1, <font id="StringLiteral">"Wittgenstein"</font>); |
|---|
| 63 | prep.setString(2, <font id="StringLiteral">"smartypants"</font>); |
|---|
| 64 | prep.addBatch(); |
|---|
| 65 | |
|---|
| 66 | conn.setAutoCommit(false); |
|---|
| 67 | prep.executeBatch(); |
|---|
| 68 | conn.setAutoCommit(true); |
|---|
| 69 | |
|---|
| 70 | ResultSet rs = stat.executeQuery(<font id="StringLiteral">"select * from people;"</font>); |
|---|
| 71 | while (rs.next()) { |
|---|
| 72 | System.out.println(<font id="StringLiteral">"name = "</font> + rs.getString(<font id="StringLiteral">"name"</font>)); |
|---|
| 73 | System.out.println(<font id="StringLiteral">"job = "</font> + rs.getString(<font id="StringLiteral">"occupation"</font>)); |
|---|
| 74 | } |
|---|
| 75 | rs.close(); |
|---|
| 76 | conn.close(); |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | </pre> |
|---|
| 80 | Run with: |
|---|
| 81 | <tt>java -cp .:sqlitejdbc-v047-native.jar -Djava.library.path=. Test</tt> |
|---|
| 82 | |
|---|
| 83 | <h3>Getting Help</h3> |
|---|
| 84 | <p>If you have any problems or questions, there is a public mailing list |
|---|
| 85 | <a href="http://groups.google.com/group/sqlitejdbc">http://groups.google.com/group/sqlitejdbc</a> |
|---|
| 86 | which I read.</p> |
|---|
| 87 | |
|---|
| 88 | <h3>Keeping Informed</h3> |
|---|
| 89 | |
|---|
| 90 | <p>To be informed when a new release is made, I recommend subscribing to the |
|---|
| 91 | <a href="http://freshmeat.net/projects/sqlitejdbc/">freshmeat project</a> for |
|---|
| 92 | this driver. Every release I make goes up there immediately with a short |
|---|
| 93 | summary of the changes. They provide a free email service with these details |
|---|
| 94 | and don't load you up with spam.</p> |
|---|
| 95 | |
|---|
| 96 | <script type="text/javascript"><!-- |
|---|
| 97 | google_ad_client = "pub-3074710994457921"; |
|---|
| 98 | google_ad_width = 468; |
|---|
| 99 | google_ad_height = 15; |
|---|
| 100 | google_ad_format = "468x15_0ads_al"; |
|---|
| 101 | google_ad_channel =""; |
|---|
| 102 | |
|---|
| 103 | <script type="text/javascript" |
|---|
| 104 | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> |
|---|
| 105 | </script> |
|---|
| 106 | |
|---|
| 107 | <p>Released under a <a href="src/LICENSE">BSD</a> license.</p> |
|---|
| 108 | |
|---|
| 109 | <p>Version control for this project is handled with |
|---|
| 110 | <a href="http://www.darcs.net">darcs</a>. You can access the darcs repo |
|---|
| 111 | via either:<br /> |
|---|
| 112 | |
|---|
| 113 | <tt>http://www.zentus.com/sqlitejdbc/src</tt><br /> |
|---|
| 114 | or<br /> |
|---|
| 115 | |
|---|
| 116 | <tt>/afs/hcoop.net/user/c/cr/crawshaw/web/zentus/sqlitejdbc/src</tt> |
|---|
| 117 | </p> |
|---|
| 118 | |
|---|
| 119 | <p>My <a href="/">other projects</a>.</p> |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | </td><td id="aside"> |
|---|
| 123 | <p>Current Version: <b>v047</b> (SQLite 3.5.8)</p> |
|---|
| 124 | |
|---|
| 125 | <h3>Download</h3> |
|---|
| 126 | <ul> |
|---|
| 127 | <li><a href="dist/sqlitejdbc-v047-nested.tgz">Pure Java</a></li> |
|---|
| 128 | <li><a href="dist/sqlitejdbc-v047-Win-i586.tgz">Windows</a></li> |
|---|
| 129 | <li><a href="dist/sqlitejdbc-v047-Mac.tgz">Mac OS X</a></li> |
|---|
| 130 | <li><a href="dist/sqlitejdbc-v047-Linux-i386.tgz">Linux</a></li> |
|---|
| 131 | <li><a href="dist/sqlitejdbc-v047-src.tgz">Source Code</a></li> |
|---|
| 132 | </ul> |
|---|
| 133 | |
|---|
| 134 | <script type="text/javascript"><!-- |
|---|
| 135 | google_ad_client = "pub-3074710994457921"; |
|---|
| 136 | google_ad_width = 120; |
|---|
| 137 | google_ad_height = 240; |
|---|
| 138 | google_ad_format = "120x240_as"; |
|---|
| 139 | google_ad_type = "text"; |
|---|
| 140 | google_ad_channel =""; |
|---|
| 141 | |
|---|
| 142 | <script type="text/javascript" |
|---|
| 143 | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> |
|---|
| 144 | </script> |
|---|
| 145 | |
|---|
| 146 | <h3>Documentation</h3> |
|---|
| 147 | <ul> |
|---|
| 148 | <li><a href="changes.html">Changelog</a></li> |
|---|
| 149 | <li><a href="usage.html">Usage</a></li> |
|---|
| 150 | <li><a href="speed.html">Speed</a></li> |
|---|
| 151 | <li><a href="functions.html">Custom Functions</a></li> |
|---|
| 152 | <li><a href="api/">Javadoc</a></li> |
|---|
| 153 | <li><a href="src/">Browse Source</a></li> |
|---|
| 154 | </ul> |
|---|
| 155 | |
|---|
| 156 | <p> </p> |
|---|
| 157 | |
|---|
| 158 | </td></tr> |
|---|
| 159 | <tr><td id="footer" colspan="2"> |
|---|
| 160 | Last modified |
|---|
| 161 | <script type="text/javascript"><!-- |
|---|
| 162 | var d = new Date(document.lastModified); |
|---|
| 163 | document.write(d.getFullYear()+"-"+d.getMonth()+"-"+d.getDate()+"."); |
|---|
| 164 | |
|---|
| 165 | </td></tr> |
|---|
| 166 | </table> |
|---|
| 167 | <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
|---|
| 168 | </script> |
|---|
| 169 | <script type="text/javascript"> |
|---|
| 170 | _uacct = "UA-2989140-1"; |
|---|
| 171 | urchinTracker(); |
|---|
| 172 | </script> |
|---|
| 173 | </body> |
|---|
| 174 | </html> |
|---|