Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Sqlite locked

sqlite

  • Please log in to reply
6 replies to this topic

#1 Mozana

Mozana

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 70 posts
  • Programming Language:Java, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C

Posted 05 February 2012 - 11:29 PM

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
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 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

Posted 06 February 2012 - 06:48 AM

Without seeing any code, it's almost impossible to help you.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#3 Mozana

Mozana

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 70 posts
  • Programming Language:Java, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C

Posted 06 February 2012 - 06:53 AM


 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();

  • 0

#4 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 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

Posted 06 February 2012 - 12:25 PM

Mozana, my guess is you still have an open connection before that section. As a result, the above runs into the file lock.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#5 Mozana

Mozana

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 70 posts
  • Programming Language:Java, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C

Posted 09 February 2012 - 10:53 PM

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
  • 0

#6 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 09 February 2012 - 11:18 PM

Setting it to null is not closing it. Connection.close() is closing it.
  • 0

#7 Mozana

Mozana

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 70 posts
  • Programming Language:Java, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C

Posted 10 February 2012 - 05:53 AM

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





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download