I strongly suggest you try out your SQL in the sqlite shell first, before running it from your C program. And making sure that your c program is single threaded and each copy is running against a different database file. That way you can differentiate between incorrect SQL, wrong C programming and multiuser interference.