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.
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");
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!