关于在 Java 中使用 JDBC 连接到 IBM 数据库

发布于 2024-08-22 18:09:47 字数 273 浏览 2 评论 0原文

我在使用 JDBC 连接到 IBM(通用)数据库时遇到问题。我使用Java在记事本中编写了代码,并加载了IBM数据库的驱动程序,即(驱动程序名称和连接URl)。当我使用常规编译(javac code.java 和 java 代码)运行代码时,我收到一条错误消息“找不到驱动程序”,但我为此指定了正确的驱动程序名称。实际上,我使用 Eclipse 使用相同的数据库和相同的驱动程序名称完成了这个程序,最后我成功了,但如果不使用 IDE,我就无法得到这个。因此,请帮助我如何在没有 IDE 的情况下进行连接以及如何在命令提示符下运行它。

I have a problem connecting to IBM (universal) database using JDBC. I wrote the code in Notepad using Java and I loaded drivers of IBM database i.e(driver name and connection URl). When I run the code using general compilation (javac code.java and java code) I am getting an error message "cannot find the driver" but I specified the correct driver name for that. Actually I did this program using Eclipse using the same database with same driver name and all and finally I succeeded, but I cant get this without using an IDE. So please help me how to connect without the IDE and how to run it in a command prompt.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

土豪 2024-08-29 18:09:47

在命令行上运行程序时,需要在类路径中包含必要的 JAR 文件。

如果您使用IBM的DB2 UDB数据库,则所需的驱动程序文件是db2jcc.jar,我认为db2jcc_license_cisuz.jardb2jcc_license_cu.jar也是获得许可所必需的。搜索这些文件,并在从命令行运行程序时将它们包含在类路径中。

You need to include the necessary JAR files on the classpath when you run your program on the command line.

If you're using IBM's DB2 UDB database, the required driver file is db2jcc.jar, and I think db2jcc_license_cisuz.jar and db2jcc_license_cu.jar are necessary for licensing as well. Search for those files, and include them on the classpath when you run your program from the command line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文