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

0

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)

 

pieckm's picture
4
Joined: Jul 18 2011 - 9:31am
Last seen: 3 years 3 months ago

8 Answers:

1

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

mdahlman's picture
1575
Joined: Mar 13 2007 - 2:43am
Last seen: 1 year 2 months ago
0

Thanks Matt - unfortunately, it was a datasource of type 'Database JDBC Connection' that I had tried to setup already.

 

Mike

pieckm's picture
4
Joined: Jul 18 2011 - 9:31am
Last seen: 3 years 3 months ago
3

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

mdahlman's picture
1575
Joined: Mar 13 2007 - 2:43am
Last seen: 1 year 2 months ago
0

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
pieckm's picture
4
Joined: Jul 18 2011 - 9:31am
Last seen: 3 years 3 months ago
0

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

mdahlman's picture
1575
Joined: Mar 13 2007 - 2:43am
Last seen: 1 year 2 months ago
0

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

pieckm's picture
4
Joined: Jul 18 2011 - 9:31am
Last seen: 3 years 3 months ago
0

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

mdahlman's picture
1575
Joined: Mar 13 2007 - 2:43am
Last seen: 1 year 2 months ago
0

Hi where can i donwlaod the db2java.zip  file. when i go through the ibm website its asking for login credintials 

i am not an ibm employee, is there a way that i can get downloaded from any site.

Thanks

 

shree909's picture
Joined: Jul 8 2013 - 4:09pm
Last seen: 11 months 4 weeks ago
Feedback