尝试设置 Java DB:“找不到类:无法加载 JDBC 驱动程序 org.apache.derby.jdbc.EmbeddedDriver" [英] Trying to set up Java DB: "Class Not Found: JDBC driver org.apache.derby.jdbc.EmbeddedDriver could not be loaded"

查看:35
本文介绍了尝试设置 Java DB:“找不到类:无法加载 JDBC 驱动程序 org.apache.derby.jdbc.EmbeddedDriver"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 SQL 完全陌生,我正在尝试建立一个数据库来练习使用它.

我使用的是 Windows 7.

我正在关注 Oracle 的 JDBC 基础教程 (http:///docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html#step1) 并且到目前为止:

  1. 安装 JDK(他们说要安装 Java SE SDK,但据我所知,JDK 和 Java SE SDK 或多或少相同?)

  2. 已安装 Apache Ant.

  3. 下载了示例代码.

  4. 修改了 build.xml.

  5. 修改了教程属性文件.

  6. 进入计算机 -> 属性 -> 高级系统... -> 环境变量并添加 PATH (C:\Program\Java\jdk1.7.0_25\bin;%ANT_HOME%/bin;C:\Windows;C:\Windows\system32).

  7. 我转到cmd,更改目录并运行ant jar.它成功遵守.

  8. 我运行 ant setup(它应该创建数据库),但收到此错误消息:

<块引用>

构建文件:C:\Program\Java\JDBCTutorial\build.xml

设置:

删除表:

构建失败 C:\Program\Java\JDBCTutorial\build.xml:140: 以下执行此行时发生错误:C:\Program\Java\JDBCTutorial\build.xml:83:找不到类:JDBC驱动程序 org.apache.derby.jdbc.EmbeddedDriver 无法加载

总时间:0 秒

我不知道我是否有 JDBC 驱动程序 - 教程说它们包含在下载中,但我不知道在哪里可以找到它们以进行验证.我还认为 PATH 变量可能有问题.我还看到有人提到类路径可能存在问题,但我不知道如何解决.

解决方案

所以你需要添加缺失的 lib.您可以在此处下载 http://db.apache.org/derby/derby_downloads.html 然后配置JAVADBDRIVER指向jar文件.

<块引用>

JAVADBDRIVER Java DB 驱动程序的完整路径名.这是通常是/lib/derby.jar.

I'm completely new to SQL, and I'm trying to set up a database to practice using it.

I'm on Windows 7.

I'm following Oracle's JDBC Basics tutorial (http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html#step1) and have so far:

  1. Installed JDK (they say to install Java SE SDK, but as far as I can tell, JDK and Java SE SDK are more or less the same?)

  2. Installed Apache Ant.

  3. Downloaded the sample code.

  4. Modified the build.xml.

  5. Modified the tutorial properties files.

  6. Gone into Computer -> Properties -> Advanced System... -> Environment Variables and added PATH (C:\Program\Java\jdk1.7.0_25\bin;%ANT_HOME%/bin;C:\Windows;C:\Windows\system32).

  7. I go to cmd, change directory and run ant jar. It complies successfully.

  8. I run ant setup (which is supposed to create the database), and I get this error message:

Buildfile: C:\Program\Java\JDBCTutorial\build.xml

setup:

drop-tables:

BUILD FAILED C:\Program\Java\JDBCTutorial\build.xml:140: The following error occurred while executing this line: C:\Program\Java\JDBCTutorial\build.xml:83: Class Not Found: JDBC driver org.apache.derby.jdbc.EmbeddedDriver could not be loaded

Total time: 0 seconds

I don't know if I have the JDBC drivers - the tutorial says they're included in the download, but I don't know where to look for them to verify. I'm also thinking there might be something wrong with the PATH variable. I've also seen people mention there could be problems with the classpath, but I don't know how to fix that.

解决方案

So you need to add the missing lib. You can download it here http://db.apache.org/derby/derby_downloads.html Then configure JAVADBDRIVERto point to the jar file.

JAVADBDRIVER The full path name of your Java DB driver. This is typically /lib/derby.jar.

这篇关于尝试设置 Java DB:“找不到类:无法加载 JDBC 驱动程序 org.apache.derby.jdbc.EmbeddedDriver"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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