I am working on a Linux platform.
I have downloaded Eclipse and also have SQLite.
I want to connect to SQLite using JDBC connectivity.
I am new to JAVA programming.
The error that I am getting is:
java.lang.ClassNotFoundException: org.sqlite.JDBC
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at ConnectSqlite.main(ConnectSqlite.java:18)
java.lang.NullPointerException
at ConnectSqlite.main(ConnectSqlite.java:32)
Here is my code:
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:/home/neeraj/neeraj/dbclass/data/neeraj.db");
statement = connection.createStatement();
resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS");
while (resultSet.next()) {
System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME"));
}
What should I do to get my code running?
You need a jar which will be containing
org.sqlite.JDBC.We do need drivers to do database connectivity using JDBC and these drivers are made avaialabe to us in the form of jar files.
Just download the jar file and include it to your classpath.
New Link to download
Below wast he original answer.
You can download it from Here