简体   繁体   English

java.sql.SQLException:找不到适用于jdbc:sqlite的驱动程序

[英]java.sql.SQLException: No suitable driver found for jdbc:sqlite

My Java program (one of my very first) seems to be hanging at the following line of standard code: 我的Java程序(我的第一个程序)似乎hanging在标准代码的以下行:

    Class.forName("org.sqlite.JDBC");

    Connection c = null;
    Statement stmt = null;
    c = DriverManager.getConnection("jdbc:sqlite:test.db");
    c.setAutoCommit(false);

I'm recieving the following error : 我收到以下error

java.sql.SQLException: No suitable driver found for jdbc:sqlite:test.db

However, when running the java application I'm providing the correct location of the jdbc driver (I think); 但是,在运行Java应用程序时,我提供了jdbc driver的正确位置(我认为);

sudo java -cp ./jsoup-1.7.3.jar:./sqlite-jdbc-3.7.2.jar:. <AppName>

any idea how to proceed? 任何想法如何进行?
thanks a million 太感谢了

 sudo java -cp ./jsoup-1.7.3.jar:./sqlite-jdbc-3.7.2.jar:. 

any idea how to proceed? 任何想法如何进行? thanks a million 太感谢了

Yes. 是。 Two major problems I see. 我看到两个主要问题。 One, unless you have a very good reason, don't run your program with sudo . 一,除非有充分的理由,否则不要使用sudo运行程序。 It could cause you major pain later if you do. 如果这样做,可能会在以后引起您的重大痛苦。

Second, your classpath doesn't look correct. 其次,您的类路径看起来不正确。 jar files are located on it. jar文件位于其上。 The first part should be the path to search and the second the jars to search for. 第一部分应该是搜索的路径,第二部分应该是要搜索的jar。

java -cp ".:jsoup-1.7.3.jar:sqlite-jdbc-3.7.2.jar" ...

Finally, I assume you downloaded from sqlite here and jsoup here and have the jar files in your current directory and if it still isn't working you should check those files are correct. 最后,我假设您是从sqlite这里jsoup下载的,并且jar文件位于您的当前目录中,如果仍然无法正常工作,则应检查这些文件是否正确。

$ sha1sum sqlite-jdbc-3.7.2.jar 
cea9f7f8e6bcb580d953a8651fb8391640de0f85  sqlite-jdbc-3.7.2.jar
$ sha1sum jsoup-1.7.3.jar 
ab1f22cadc2f8b514e55ba368f5128056fe304da  jsoup-1.7.3.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.sql.SQLException:找不到适用于jdbc:sqlite:db / Fakturi.sqlite的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:sqlite:db/Fakturi.sqlite java.sql.SQLException:找不到适合jdbc:oracle:thin的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:oracle:thin java.sql.SQLException:找不到适用于jdbc:derby的驱动程序: - java.sql.SQLException: No suitable driver found for jdbc:derby: java.sql.SQLException:找不到适用于jdbc:mysql的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql java.sql.SQLException:找不到适用于jdbc:sqlserver的驱动程序: - java.sql.SQLException: No suitable driver found for jdbc:sqlserver: java.sql.SQLException:没有找到适合 jdbc:microsoft:sqlserver 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver java.sql.SQLException:找不到适用于jdbc:microsoft的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:microsoft java.sql.SQLException:找不到适合jdbc的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc 错误:java.sql.SQLException:未找到适合jdbc:sqlserver的驱动程序 - Error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver java.sql.SQLException:找不到合适的驱动程序jdbc:oracle:thin - java.sql.SQLException: No suitable driver found jdbc:oracle:thin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM