Jump to content
We've recently updated our Privacy Statement, available here ×

Cannot find DB2 Driver when creating a new DB connection; Services OK


pieckm

Recommended Posts

Hello -

I am working through the iReport tutorials and can connect fine to the sample database provided with Jasper.  Howver, when I try to connect to my DB2 database the DB2 Driver shows as red in the connections wizard and I receive an error that the necessary Driver class cannot be found.

I have added the Driver in the Services window and successfully setup a New Connection in the services window.  I know it works since I was able to select a particular schema during the Services Connection setup process.  I also ensured the two required IBM DB2 jar files are in the classpath (in Tools->Options->Classpath).   I've even tried putting the two jars in the 'lib' directory of iReport.

Any pointers appreciated.

Thank you.

Mike

(iReport Designer 4.02, DB2 version 9 fixpack 6, windows server 2003)

 

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Try creating a new datasource of type "Database JDBC connection" rather than "NetBeans Database JDBC connection". Given that you have already set the classpath correctly (in Tools->Options->Classpath), this datasource should work immediately.

Regards,
Matt

Link to comment
Share on other sites

Ahh...

Then my next guess is that you're not using the driver that you want to be using. The iReport drop down shows "The APP driver":

IBM DB2 (COM.ibm.db2.jdbc.app.DB2Driver)

But you probably want "The Universal driver":

com.ibm.db2.jcc.DB2Driver

The iReport GUI is very confusing in this regard. But you can just type in the correct class and things will work as they should. Give this a try.

Regards,
Matt

Link to comment
Share on other sites

Thanks Matt.  I finally did get this resolved.  There were three issues and I include them here in case others come across this thread.  Hopefully the folks at Jasper can help address the 2nd and 3rd points:

  1. ·         Ensure db2java.zip is in your classpath
    1. I already had db2jcc-V9-FP06.jar and db2jcc_license_cu-V9_FP06.jar, but these weren't enough
  2. At this point do not use the available DB2 driver in the Database JDBC Connection window, but instead manually key in com.ibm.db2.jcc.DB2Driver
    1. By default, iReport gives you COM.ibm.db2.jdbc.app.DB2Driver, perhaps this should be corrected
  3. Also, do not accept the JDBC URL form as generated by the wizard, your URL must be of the form jdbc:db2://<hostname>:<port>/<database>
    1. iReport omits the //    Again, hopefully this can be corrected
Link to comment
Share on other sites

pieckm,

Thanks for posting the details.

I wouldn't call the choice in iReport a bug to be corrected. "The APP driver" is a valid DB2 driver provided by IBM. Having it in the list is reasonable. The proposed url is correct for this driver.

But "The Universal driver" is much more commonly used. This is the driver you wanted. Adding this would be great.

Please log this in the tracker as an enhancement request.

Regards,
Matt

Link to comment
Share on other sites

Any idea on what I would've had to do to get the APP driver working? 

I didn't have any particular preference on app versus universal.  Along with a fellow iReport user here at work, we just tried various combinations of jars, zip files, and entries in that data source screen until something worked.

It likely would've been easier to get the APP driver workign since iReport seems to natively know something about that driver, but I couldn't figure out how to do it..

 

Thanks

Mike

Link to comment
Share on other sites

Mike,

It's a little misleading to think that iReport knows something about the APP driver. It includes it in its hard-coded list of drivers. But that's it. It doesn't include the driver.

Here's my summary of the DB2 drivers that I put together for my own use. Perhaps it will help.

  • "The APP driver" - The IBM DB2 App Driver is a type-2 JDBC driver. This means you must install the DB2 client classes (dlls) on your client. This is generally bad for us.
    • driver: COM.ibm.db2.jdbc.app.DB2Driver
    • url: jdbc:db2:<dbname>
    • delivered in: db2java.zip
  • "The Universal driver" - The IBM DB2 Universal Driver is a type-2 JDBC driver.
    • driver: com.ibm.db2.jcc.DB2Driver
    • url: jdbc:db2:<dbname>
    • delivered in: db2jcc.jar
  • "The NET driver" (occasionally known as "The COM driver" - The Net Driver is a type-3 JDBC driver.
    • driver: COM.ibm.db2.jdbc.net.DB2Driver
    • url: jdbc:db2://<server hostname or IP address>:<DB2 JDBC Applet Server port number> / <dbalias>
    • delivered in: db2java.zip
  • "The Universal driver" - The IBM DB2 Universal Driver is a type-4 JDBC driver.
    • driver: com.ibm.db2.jcc.DB2Driver
    • url: jdbc:db2://<server hostname or IP address>:<DB2 UDB Instance port number> / <dbalias>
    • delivered in: db2jcc.jar & db2jcc_license_cu.jar
  • Note that the universal driver is listed twice. The same class can be used as a type-2 or a type-4 driver. You have to look at the url to know which one is being used.
  • All the rules change with DB2 for iSeries (AS/400, System i, whatever it's called now). The above notes apply only to DB2 UDB. 

Regards,
Matt

Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...

Pickm's answer:

  1. ·         Ensure db2java.zip is in your classpath
    1. I already had db2jcc-V9-FP06.jar and db2jcc_license_cu-V9_FP06.jar, but these weren't enough
  2. At this point do not use the available DB2 driver in the Database JDBC Connection window, but instead manually key incom.ibm.db2.jcc.DB2Driver
    1. By default, iReport gives you COM.ibm.db2.jdbc.app.DB2Driver, perhaps this should be corrected
  3. Also, do not accept the JDBC URL form as generated by the wizard, your URL must be of the form jdbc:db2://<hostname>:<port>/<database>
    1. iReport omits the //    Again, hopefully this can be corrected

Worked perfect for me. I had a few differences:

  • I went to the IBM website https://www-01.ibm.com/support/docview.wss?uid=swg21363866  
  • I downloaded "JDBC 4.0 Driver (dbcjcc4.jar)"
  • I uncompressed the downloaded file in a temporary folder
  • I copied the file called "db2jcc.jar" in a permanent location
  • I added db2jcc4.jar to the IReport classpath using "Add JAR"
Link to comment
Share on other sites

  • 10 months later...

Hi, everyone i have the same problem plus i have to change the jre path to the 1.7 because i have the 1.8 in my machine im using iReport 5.6.0 with db2 db 10.5 fixpack 5. I discover the iReport do not open with that jre version. I could made run and open, but im having the same problem to try to connecto the DB2 db i tray everything that i can far search in google and this post to, i will details now what i try, so if someone can give me a hint so solve this.

  1. I rename the db2java.zip to db2java.jar an added to the ireport classpath using "Add JAR", this didnt work...for this case i used the zip was in the SQLIB folder (IBMSQLLIBjava).
  2. Tried to use COM.ibm.db2.jdbc.app.DB2Driver and COM.ibm.db2.jdbc.jcc.DB2Driver as a driver in the configuration of the DataSource.
  3. I try renaming the driver that ireport give for db2, so i try with COM and com,  this didnt work.
  4. I try ussing driver db2jcc.jar and db2jcc4.jar, this didnt work...forgot mention i downloaded the drivers from IBM repositories.

What i see a difference between iReport and jaspersoft studio is they using different driver to connect to de DB2 db

iReport use this driver: IBM DB2 (COM.ibm.db2.jdbc.app.DB2Driver)

jaspersoft studio use this drivers: com.ibm.db2.jcc.DB2Driver

Can someone help to understand why i cant made the connection to my db and why this to tools use different drivers?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...