SQLException: 找不到适合 jdbc:derby://localhost:1527 的驱动程序 [英] SQLException: No suitable driver found for jdbc:derby://localhost:1527

查看:42
本文介绍了SQLException: 找不到适合 jdbc:derby://localhost:1527 的驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Netbeans 中遇到此错误:

I get this error in Netbeans:

java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/

这是怎么引起的,我该如何解决?

How is this caused and how can I solve it?

推荐答案

java.sql.SQLException: 找不到适合 jdbc:derby://localhost:1527/的驱动程序

java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/

这个异常有两个原因:

  • 未加载驱动程序.
  • JDBC URL 格式错误.

在您的情况下,我希望在连接字符串的末尾看到一个数据库名称.例如(如果您希望在数据库不存在的情况下创建该数据库,请使用 create=true):

In your case, I'd expect to see a database name at the end of the connection string. For example (use create=true if you want the database to be created if it doesn't exist):

jdbc:derby://localhost:1527/dbname;create=true

数据库默认创建在网络服务器启动的目录中.但是你也可以指定数据库位置的绝对路径:

Databases are created by default in the directory where the Network Server was started up. But you can also specify an absolute path to the database location:

jdbc:derby://localhost:1527//home/pascal/derbyDBs/dbname;create=true

为了以防万一,请检查 derbyclient.jar 是否在类路径上,并且您正在加载适当的驱动程序 org.apache.derby.jdbc.ClientDriver在服务器模式下工作.

And just in case, check that derbyclient.jar is on the class path and that you are loading the appropriate driver org.apache.derby.jdbc.ClientDriver when working in server mode.

这篇关于SQLException: 找不到适合 jdbc:derby://localhost:1527 的驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆