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

查看:601
本文介绍了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天全站免登陆