开发者

Connecting to SQLite Database Fails

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 imp开发者_运维技巧ort the driver into my Eclipse project?


Try this:-

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜