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.
(iReport Designer 4.02, DB2 version 9 fixpack 6, windows server 2003)
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":
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.
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:
- · Ensure db2java.zip is in your classpath
- I already had db2jcc-V9-FP06.jar and db2jcc_license_cu-V9_FP06.jar, but these weren't enough
- 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
- By default, iReport gives you COM.ibm.db2.jdbc.app.DB2Driver, perhaps this should be corrected
- 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>
- iReport omits the // Again, hopefully this can be corrected
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.
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..
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.