简体   繁体   中英

Eclipse (Mule ESB) Error: java.sql.SQLException: Error trying to load driver

From Eclipse I added a database connection using JDBC. To do this I did the following

I created a User Library, as follows

Windows -> Preferences -> Java -> Build Path => User Libraries

Then press the 'New' button, and create a lib

Then hit the 'Add External JARs' button to add JARS external to ECLIPSE

From there I loaded the following files:

db2jcc.jar
db2jcc_license_cu.jar

Then I added the User Library I created to the project Build path as follows:

  • Rt click on the project
  • click on Properties
  • Click on "Java Build Path"
  • Check "TEST_LIB" (the name of the User Library

Then I selected the Driver name class from the wizard (now that the libraries are in the project, magically the GUI can see the class name

com.ibm.db2.jcc.DB2Driver

I select the class name and put in a url, and TEST THE CONNECTION

The test of the connection is SUCCESSFUL !!!!

I am happy so I pop in a prepared statement:

SELECT SUM(BALANCE) FROM ACCOUNT

And then I run the flow as a "Mule Application"

But when I sent an http message to it I get the following error:

java.sql.SQLException: Error trying to load driver: com.ibm.db2.jcc.DB2Driver :
com.ibm.db2.jcc.DB2Driver (org.mule.module.db.internal.domain.connection.Connect
ionCreationException). Message payload is of type: String

So I can now test the connection when the flow is not running, but when the flow is running, it can not find the driver I used to test the connection with

Any ideas of where I should look to resolve this issue

STUDIO packages your app and deploys this in Mule server, in doing this it is not packaging the jars you are adding via user libraries. A workaround is to ass the jars via "Add external jars" in "Java Build Path" of the project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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