Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:29:43+00:00 2026-06-06T02:29:43+00:00

I have a single-threaded application that uses 3 SQLite databases in 3 different files

  • 0

I have a single-threaded application that uses 3 SQLite databases in 3 different files on the local file system.

I have created a DbAdapter helper class that opens the connection to the SQLite database file. In this class I have an open method that creates the connection, and a close method that releases everything.

The 3 databases are accessed from a class that derives DbAdapter.

In my program every database access look like this:

MyDbAdapter DB = new MyDBAdapter();
int stuff = DB.getStuff(); // queries the database
DB.close();
// now do something with `stuff`

I have logged to stdout all calls to DbAdapter.open and DbAdapter.close. Everytime there’s an open(), a close() follows close by.
I also take the care to close all my Statements (which will cause the associated ResultSets to be closed aswell).

So I guess that my database accesses are clean because I’m trying to get them as short as possible, and I release all the resources as soon as I no longer need them.

Yet, I’m still getting a java.sql.SQLException: database is locked.

Is there anything that I’m not doing properly? I know I haven’t shown any code, but I’d have to post a LOT of code and it won’t be relevant. I’m just asking if I’m using the best practises here, because I think I do and I’m still getting exceptions.

This is with Java 1.6, Xerial.org’s sqlite-jdbc-3.7.2 driver, on Mac OS 10.6 x64

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:29:45+00:00Added an answer on June 6, 2026 at 2:29 am

    I noticed that I had strange Java processes that I couldn’t kill. I ran:

    ps aux | grep java | grep -v grep | awk '{print$2}' | xargs sudo kill -9
    

    But those processes were still here (with same PID).

    I rebooted, and the problem doesn’t appear anymore. This doesn’t make sense because I was able to make a lot of DB calls without any crash, there was just one single call that caused the exception. I don’t understand at ALL what happened, but I’m no longer having this issue.

    Any real answer welcome.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an single threaded, embedded application that allocates and deallocates lots and lots
I have a supposedly single-threaded FLTK application with a popup menu, created with Fluid.
I have a single-view application that takes in a username and a password and
I have a shutdown hook handler defined in a SINGLE threaded C application. int
I currently have a GUI single-threaded application in C++ and Qt. It takes a
I have an application that uses Task (TPL) objects for asynchronous execution. The main
I have a small single-threaded C++ application, compiled and linked using Visual Studio 2005,
I have a multi-threaded application that I'm debugging inside the IDE (Visual Studio 2008,
I have a PHP based multi-threaded application that I'm try to get working with
I have written a simple single threaded client server application in Visual C++ .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.