In my scenario it has Sync_Class that syncs, with AsyncTasks in background , from my app to my server. Every time that my app does one action that need to change data from my SQLite, as first step my app updates my local database as second step throws a AsyncTask in background to start the sync with my server. In the 80% of cases my app works great but the other 20% of cases throws a IllegalStateException because the app try to re-open the connection or open a closed connection, when I have a method to open database in 6 lines more above. In this cases I think the problem is multiple simultaneous acceses in database, I'm right?
In the differents posts that I can read, the people talk about de SQLite can't execute a simultaneous connections and it serialized connections because file structures not permit... The final question is, If we do multiples asyncTasks with sqlite connections to do inserts, updates and deletes, to harness the full power of the processor with parallel programming, we have any tools for do this? Or it's a non-viable option and we need to do a serialized connections?
If you have any solutions or any ideas for my problem, help me!! Thanks in advance!!
More info: My BDDclass have a method for open database. When I need to execute query, rawquery, etc... in a simple function or void I call my database class, opens database, executes the query or multiple queries and at the end we close the database. When I know that i have a large process with a multiples functions with querys in this case I create BDDclass and opens bdd at start and at the end closes the database of this process.
I say this because I can see some posts that people recommend use the SQLiteHelper because this helps to administrate multiple simultaneous connections in SQLite, but others posts says that have the same problem that I have... Then it's must to use SQLiteHelper? Or not?
If you need more information or something let me know.
Finally I solved the problem!! The problem is that I try to control the acceses to the database, opening and closing the databases when I need read or write in the databases with parallel programming (background asyncTasks). Must remember that I don't use SQLiteHelper and I solved the problem calling my database class one time per activity, this mean open my database one time and close this when my app is pause and reconect with BDD when my app come in first plane other time then connects with my database.
In resume, never close your database and you can use a parallel programming with multiple accesses in SQLite. Greetings!!