简体   繁体   English

关于使用Java中的JDBC与IBM数据库的连接

[英]About the connectivity to IBM database using JDBC in Java

I have a problem connecting to IBM (universal) database using JDBC. 我使用JDBC连接到IBM(通用)数据库时遇到问题。 I wrote the code in Notepad using Java and I loaded drivers of IBM database ie(driver name and connection URl). 我使用Java在记事本中编写了代码,并加载了IBM数据库驱动程序,即(驱动程序名称和连接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. 当我使用常规编译(javac code.java和java代码)运行代码时,我收到一条错误消息“找不到驱动程序”,但是我为此指定了正确的驱动程序名称。 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. 实际上,我使用具有相同驱动程序名称和相同驱动程序的相同数据库使用Eclipse来完成了该程序,但最终我成功了,但是如果不使用IDE就无法获得此程序。 So please help me how to connect without the IDE and how to run it in a command prompt. 因此,请帮助我如何在没有IDE的情况下进行连接以及如何在命令提示符下运行它。

You need to include the necessary JAR files on the classpath when you run your program on the command line. 在命令行上运行程序时,需要在类路径中包括必要的JAR文件。

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. 如果您使用的是IBM的DB2 UDB数据库,则所需的驱动程序文件是db2jcc.jar ,我认为db2jcc_license_cisuz.jardb2jcc_license_cu.jar也是许可所必需的。 Search for those files, and include them on the classpath when you run your program from the command line. 搜索这些文件,并在从命令行运行程序时将它们包括在类路径中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM