连接到SQLite数据库失败

连接到SQLite数据库失败

问题描述:

我试图在Java Applet中访问我的SQLite3数据库。当我运行我的代码连接到数据库时,我收到此错误找不到合适的驱动程序a.db ,我该如何解决?

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?

现在我不完全确定我确实安装了正确的驱动程序......我会告诉你我做了什么&你能告诉我还需要做些什么来让Eclipse IDE找到SQLitejdbc驱动程序:

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 :在Windows 7上,使用Eclipse Helios Java

  • 我在python&中创建了一个SQLite3数据库。我想在我的Java Applet中阅读它

  • 我从 http://www.zentus.com/sqlitejdbc/

  • 然后我复制了&将上述文件粘贴到路径C:\Program Files \ Java \ jre6 \lib& C:\Program Files\Java\jre6\lib\ext

  • 在Java Applet&中运行以下代码。得到一个文本引发的异常:没有为a.db找到合适的驱动程序

  • 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

任何信息都会非常有用。我是否需要将驱动程序导入Eclipse项目?

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

试试这个: -

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