Connecting to SQLite Database Fails

3.3k views Asked by At

I am attempting to access my SQLite3 database in a Java Applet. When I run my code to connect to the database I get this error No suitable driver found for a.db, how can I fix it?

Now I am not entirely sure I have actually installed the correct driver...I will tell you what I have done & could you tell me what else I need to do to make Eclipse IDE find the SQLitejdbc driver:

  • BK info: On windows 7, using Eclipse Helios Java
  • I have a SQLite3 database created in python & I want to read it in my Java Applet
  • I have downloaded the file sqlitejdbc-V056.jar from http://www.zentus.com/sqlitejdbc/
  • Then I copied & pasted the above file to the paths C:\Program Files\Java\jre6\lib & C:\Program Files\Java\jre6\lib\ext
  • Run the following code in a Java Applet & get an exception thrown with the text: "No suitable driver found for a.db"
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("a.db"); // exception thrown here

Any information would be really helpful. Do I need to import the driver into my Eclipse project?

1

There are 1 answers

0
limc On

Try this:-

Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:a.db");