0

I am trying to connect to a DB2 database on a Mainframe. I am using the db2jcc.jar driver. My config looks like this:

<spring:beans>
   <spring:bean id="db2DataSource" name="db2DataSource" class="com.ibm.db2.jcc.DB2DataSource" destroy-method="finalize" scope="singleton">
      <spring:property name="serverName" value="mycompany.com"/>
      <spring:property name="portNumber" value="7803"/>
      <spring:property name="databaseName" value="DBNAME"/>
      <spring:property name="driverType" value="4"/>
      <spring:property name="user" value="username"/>
      <spring:property name="password" value="password"/>
   </spring:bean>
</spring:beans>

<db:generic-config name="DB2_Database" 
   driverClassName="com.ibm.db2.jcc.DB2Driver"  
   doc:name="Generic Database Configuration" dataSource-ref="db2DataSource"/>    

<flow name="databaseexampleFlow">
   <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/>
   <db:select config-ref="DB2_Database" doc:name="Select from Table">
      <db:dynamic-query><![CDATA[SELECT * FROM DB2.EA_SALEFRC_PRCSPOC;]]></db:dynamic-query>
   </db:select>
   <logger message="Selection: #[payload]" level="INFO" doc:name="Logger"/>
</flow>

I am getting an error complaining about the DB2DataSource class.

Caused by: java.lang.ClassNotFoundException: Cannot load class 'com.ibm.db2.jcc.DB2DataSource'

I can Test the connection and it works fine. Any ideas?

mustaccio
  • 18,234
  • 16
  • 48
  • 57
user1379903
  • 83
  • 1
  • 1
  • 6
  • You do not provide version of your jdbc driver so I cannot tell for sure. But usually DB2 driver contains 2 jars and since you miss class it looks like you missed this second jar in class path. – Alex Jan 20 '17 at 14:13
  • Clearly Mulesoft cannot find the driver class in its classpath. – mustaccio Jan 20 '17 at 14:52

1 Answers1

0

Please check when you build your project for deploying the jar's for DB2 driver are exported with your project.

you can go to {mule home}/apps/{your application}/lib

and check if jar's are available or not.