Jump to content

Sqlite locked

- - - - -

  • Please log in to reply
6 replies to this topic

#1
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
I am using sqlite for standard edition of java reason is that i did not want to use much space.
Any way so wen I try to update the info in there it says that the database has been locked, pls
give me some advice

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Without seeing any code, it's almost impossible to help you.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts

 getDBConn();

            prep = conn.prepareStatement("insert into tblGroups values (?,?,?,?,?)");

            for (Group grp : groups)

                if (!exists(grp))

                    prep.setString(1, grp.getName());

                    prep.setString(2, grp.getDescription());

                    prep.setString(3, grp.getId() + "");

                    prep.addBatch();

                    prep.executeUpdate();

                    saveRecipients(grp.getRecipients());

                    

                }

            }


        } catch (SQLException ex) {

            Logger.getLogger(DBService.class.getName()).log(Level.SEVERE, null, ex);

        }

        closeConnDB();


#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Mozana, my guess is you still have an open connection before that section. As a result, the above runs into the file lock.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
the thing is even if I set the connection to null and reinitialise it the exception is thrown, guess Ill try a different db, Thank you man

#6
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Setting it to null is not closing it. Connection.close() is closing it.

#7
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
lol yea, I also kept calling the
closeConnDB();
which duz close the method, but yea I am now using sqljet




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users