Runtime error connecting sqlite to netbeans

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 1144999
    New Member
    • Mar 2016
    • 2

    Runtime error connecting sqlite to netbeans

    I'm having difficulty connecting my sqlite database to my netbeans application. Once i run the code below i get the error

    /Users/lm/Library/Caches/NetBeans/8.1/executor-snippets/run.xml:48:
    Cancelled by user.
    BUILD FAILED (total time: 1 second)
    I have also imported the jar file into the library called sqlite-jdbc 3.6.13 jar and installed the sqlite plugin.

    Code

    Code:
    import java.sql.*;
    
    public class ConnecttoDB
    {
        public static void main( String args[] )
        {
            Connection c = null;
                try {
                    Class.forName("org.sqlite.JDBC");
                    c = DriverManager.getConnection("jdbc:sqlite:/Users/lm/Documents/JavaProject.sqlite");
                } catch ( Exception e ) {
                    System.err.println( e.getClass().getName() + ": " + e.getMessage() );
                    System.exit(0);
                }
            System.out.println("Opened database successfully");
        }
    }
    Last edited by Rabbit; Mar 10 '16, 08:44 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...