Re: [sqlite] New JDBC driver for SQLite

2006-07-30 Thread Michael Scharf

Hi David,

I quickly looked at the code -- it's amazingly small!
I really like that. I have to do some performance tests
to see if it fits my needs..

Michael


I have written a new JDBC driver for SQLite.

http://java.zentus.com/sqlitejdbc.html

It is designed to be easy to read and as thin a layer as possible on
top of the C functions. The new _prepare()/_step() API is surprisingly
similar to the JDBC API, making it efficient code. SQLite is compiled
straight into the JNI binary, which keeps things simple for Java
programmers. There is only one dll/so/jnilib that needs to be added to
a project.

I've build binaries for Linux i386, Mac (universal) and Windows. Any
testing would be greatly appreciated, I don't have much hardware.

My few speed tests so far suggest it is fast. Code like:

   statement.setAutoCommit(false);
   for (int i=0; i  1000; i++)
   statement.executeUpdate(INSERT INTO...);
   statement.commit();

runs in under 30ms on Linux. This means the JNI bridge is not causing
any serious overhead.

There are still a couple of features to add. I plan automatic Java
date/time handling and the code is not thread safe. These are not
difficult to do, I am just distracted by another optimisation right
now.

The code is under the BSD license. I hope someone finds a use for it.

d





--
http://MichaelScharf.blogspot.com/



Re: Re: [sqlite] New JDBC driver for SQLite

2006-07-30 Thread David Crawshaw

Michael Scharf wrote:

I quickly looked at the code -- it's amazingly small!
I really like that. I have to do some performance tests
to see if it fits my needs..


Thanks. I think you will find the JNI is not a problem, I tested it on
its own and the overhead is non-existent. The problem you should test
for is String speed.

Try using PreparedStatement.setString() and ResultSet.getString() a
lot, along with the BLOB equivalents. The memory copying might be a
problem.

d