java.lang.ClassNotFoundException:在 Worklight 平台或项目中找不到类 com.ibm.db2.jcc.DB2Driver

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19128792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:20:10  来源:igfitidea点击:

java.lang.ClassNotFoundException: Class com.ibm.db2.jcc.DB2Driver not found in Worklight platform or project

javadb2ibm-mobilefirst

提问by Mindan

I try to test an sql adapter that connects to db2 but I get the following result:

我尝试测试连接到 db2 的 sql 适配器,但得到以下结果:

java.lang.ClassNotFoundException: Class com.ibm.db2.jcc.DB2Driver not found in Worklight platform or project

java.lang.ClassNotFoundException:在 Worklight 平台或项目中找不到类 com.ibm.db2.jcc.DB2Driver

here is my code:

这是我的代码:

<dataSourceDefinition>
    <driverClass>com.ibm.db2.jcc.DB2Driver</driverClass>
    <url>jdbc:db2://localhost:50000/WLTEST</url>
    <user>db2admin</user>
    <password>db2admin</password> 
</dataSourceDefinition>

any idea what is going wrong?

知道出了什么问题吗?

采纳答案by Idan Adar

Do you mean that your Worklight database is DB2-based? If yes,

您的意思是您的 Worklight 数据库是基于 DB2 的吗?如果是,

  • make sure to also edit worklight.properties with the correct DB2 setup
  • 确保还使用正确的 DB2 设置编辑 worklight.properties

Also make sure that:

还要确保:

  • the DB2 connector driver exists in the server\lib folder
  • DB2 连接器驱动程序存在于 server\lib 文件夹中

回答by Ayanava Sarkar

Add the two jars:

添加两个罐子:

db2jcc.jar
db2jcc_license_cu.jar

db2jcc.jar
db2jcc_license_cu.jar

Add them to the libraries jarfolder.

将它们添加到库jar文件夹中。