I think the problem is the "free" in this function:
JNIEXPORT jint JNICALL Java_org_sqlite_NativeDB_bind_1text(
JNIEnv *env, jobject this, jlong stmt, jint pos, jstring v)
{
const char *chars = (*env)->GetStringUTFChars(env, v, 0);
return sqlite3_bind_text(toref(stmt), pos, chars, -1, free);
}
In JNI, as far as I know, you must release memory returned from
GetStringUTFChars() with ReleaseStringUTFChars(), not free().
Try this (untested, never compiled):
JNIEXPORT jint JNICALL Java_org_sqlite_NativeDB_bind_1text(
JNIEnv *env, jobject this, jlong stmt, jint pos, jstring v)
{
const char *utf = (*env)->GetStringUTFChars(env, v, 0);
int rc = sqlite3_bind_text(toref(stmt), pos, utf, -1,
SQLITE_TRANSIENT);
(*env)->ReleaseStringUTFChars(env, v, utf);
return rc;
}
With any luck, this should avoid the crash.
--- madworld <[EMAIL PROTECTED]> wrote:
> I'm using the SQLiteJDBC in a servlet. Each thread going against a
> different db/file.
> When I run multiple threads (by running a client program multiple
> times), the JVM aborts (see below dump..)
...
> Stack: [0x0b450000,0x0b490000), sp=0x0b48f478, free space=253k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
> C=native code)
> C [sqlitejdbc.dll+0x45471]
> C [sqlitejdbc.dll+0x4560e]
> C [sqlitejdbc.dll+0x23da]
> J org.sqlite.NativeDB.bind_text(JILjava/lang/String;)I
> J org.sqlite.DB.sqlbind(JILjava/lang/Object;)I
> J org.sqlite.DB.executeBatch(JI[Ljava/lang/Object;)[I
> j org.sqlite.PrepStmt.executeBatch()[I+21
> j util.jdbc.UCPersistSqlite.executePrepBatch(Lutil/jdbc/PrepStmt;)V+6
> J Main.UCReader.doPrepStatementInserts()V
> j Main.UCReader.persist()V+65
> j Main.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/
> servlet/http/HttpServletResponse;)V+413
> j Main.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/
> http/HttpServletResponse;)V+3
> j javax.servlet.http.HttpServlet.service(Ljavax/servlet/http/
> HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+139
____________________________________________________________________________________You
snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLiteJDBC" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlitejdbc?hl=en
-~----------~----~----~----~------~----~------~--~---