Derek Battams <[EMAIL PROTECTED]> wrote:
> Is there a way to increase the timeout period before the exception is
> thrown? Better yet, can the timeout be disabled and block
> indefinitely?
Increasing the timeout is easy. Just recompile with something like this:
--- src/org/sqlite/Conn.java.orig 2008-03-02 15:36:30.000000000 +1100
+++ src/org/sqlite/Conn.java 2008-03-10 13:06:09.000000000 +1100
@@ -77,7 +77,7 @@
this.url = url;
db.open(this, filename);
- setTimeout(3000);
+ setTimeout(10000);
}
int getTimeout() { return timeout; }
Sadly the JDBC interface doesn't provide an interface for this, so to
make this a runtime setting I would have to add an ugly (and unsual
for java) System.getProperty(). I may do this in the next release
("org.sqlite.timeout").
Making the timeout indefinite would be more complicated. Instead of
just calling sqlite3_busy_timeout(), the code would have to register a
custom busy handler with sqlite3_busy_handler().
Note that despite this timeout, it is still possible to get a "db is
locked" exception when the possibility of a deadlock appears. For
details see:
http://www.sqlite.org/c3ref/busy_handler.html
I may have to subclass SQLException and throw a LockedException, so
people can do a neater job of catching it.
But before doing this,consider one important question: why do you have
a select open for 2-5 seconds? There are some legitimate reasons,
complex aggregating joins on 100s of millions of records, but most
likely, you open the select, do a bunch of work not dependent on the
select being open, and close it. Far better than locking your users up
for many seconds at a time would be shortening your code path.
d.
--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---