This discussion is archived
1 Reply Latest reply: Sep 21, 2011 7:40 AM by 889446 RSS

Strange error when preparing statement "Thread/process failed"

889446 Newbie
Currently Being Moderated
I am getting a strange error when executing my program. I have data in a simple table, and when I prepare a statement, it prints "BDB0113 Thread/process 6428/5360 failed: BDB1507 Thread died in Berkeley DB library". However, the program continues execution without issue. It seems like an important error message though, and I would like to understand what is happening.

I think I might have corrupted my database some how. Does anyone know what might cause this? I have a test program that can reproduce it. The test program is unremarkable, I think the database was previously corrupted. My overall program is too complex to post here. But maybe someone can give a clue as to how I am misusing the database.

Connecting to DB:C:\dev\SQLite\testDB\DKTDB.sqt
Database connected successful
C:\dev\SQLite\testDB\DKTDB.sqt: BDB0113 Thread/process 6428/5360 failed: BDB1507 Thread died in Berkeley DB library
0 : not an error
100 : unknown error
Printing Row
| TABLE_ID : NUMBER | TABLE_TYPE : VARCHAR2(40) | TABLE_NAME : VARCHAR2(60) | BASIN_AREA : FLOAT(63) | X : FLOAT(126) | Y : FLOAT(126) | REMARK : VARCHAR2(200) |
| 1| UNKNOWN| TableAwesome| 20000.000000| 100.000000| 200.000000| NULL|
Database closed successfully


//Sorry it looks funky on the forum
void reproduceError(){

     char dbName[64];
     db_handle* db;
     int err = 0;
char sql[4096];
     db_stmt* ppStmt;
     const char* msg;

     sprintf_s(dbName, "C:\\dev\\SQLite\\testDB\\DKTDB.sqt");

     fprintf(stderr, "Connecting to DB:%s\n",dbName);
     
     /* Open database. */
     sqlite3_open(dbName, &db);
     
     err = sqlite3_errcode(db);

     if(err!=0){
          fprintf(stderr, "Connection to database returned error code %i\n", err);
     } else {
          fprintf(stderr, "Database connected successful\n");
     }

     sprintf_s(sql, "select * from TABLE_A;");

     //prepare the sql
     err = sqlite3_prepare_v2(db, sql, -1, &ppStmt, NULL);
     msg = sqlite3_errmsg(db);
     fprintf(stderr, "%i : %s\n", err, msg);

     err = sqlite3_step(ppStmt);
     msg = sqlite3_errmsg(db);
     fprintf(stderr, "%i : %s\n", err, msg);

     if(err == SQLITE_DONE){ //statement has finished executing successfully

     } else if(err == SQLITE_ROW){
          printRow(ppStmt);
     } else {
          //...
     }

     sqlite3_finalize(ppStmt);

     err = sqlite3_close(db);

     if(err!=0){
          fprintf(stderr, "Database close returned error code %i\n", err);
     } else {
          fprintf(stderr, "Database closed successfully\n");
     }

}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points