Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: java cant find my sqlite file

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    26
    My Mood
    Aggressive
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default java cant find my sqlite file

    i placed my sqlite file on src/Database folder in my project.

    Untitled.jpg

    and in my code, i have this...
                String filePath = "\\Database\\glacier.sqlite";
                connect = DriverManager.getConnection("jdbc:sqlite:"+getClass().getResource(filePath));

    and!

                stat = connect.createStatement();
                res = stat.executeQuery("select value from controls where command == 'A'");
                A = res.getInt("value");

    but it errors and says,

    java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: controls)

    this is so terrible i have controls table in my sqlite!

    Untitled1.jpg

    please help me solve this


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: java cant find my sqlite file

    The database you are referring is in your source directory, but your runtime is most likely operating off of class files in another directory (typically named bin) - be sure your databases between the two are in sync

Similar Threads

  1. Very frustrating problem with writing to a file, cannot find file when overwriting.
    By lordofrandom in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: June 18th, 2013, 06:18 AM
  2. Need help performing a find and replace on an XML file using Java
    By atignola in forum What's Wrong With My Code?
    Replies: 6
    Last Post: June 5th, 2013, 02:49 PM
  3. Help with sqlite please
    By mikesummer78 in forum JDBC & Databases
    Replies: 1
    Last Post: July 5th, 2012, 08:26 PM
  4. Find the important class in ".mse" file using Java program
    By ashwarth21 in forum Java Theory & Questions
    Replies: 3
    Last Post: March 13th, 2012, 07:43 PM