CATEGORIES
Installing JDBC Driver for DB2 and Tomcat
How to Install JDBC Driver for DB2
Published by: San (9/11/2007)
DB2 is a database developed by IBM and it provides DB2 Express-C for free. It can be downloaded from the IBM site and it also installs the jdbc driver while installing the package. If you don’t have DB2 running on your machine or trying to run some java apps over tomcat then you might need a JDBC Driver to connect DB2 and run your applications on Tomcat. Follow the under given steps to install the JDBC driver for DB2 and it should be get going after that.
The files to download are db2jcc.jar and db2jcc_license_cu.jar in order to make your apps talk to DB2 database – there are multiple ways to download it from the IBM web site. The easiest way to reach these files and download it to your server is downloading the jdbc driver for all Operating Systems.
Once you have these files then put that in your local lib folder under your app root folder -- I mean you have a lib folder under WEB-INF folder so put these two files in it. If you are running tomcat on windows then it’s all set but if you are running the tomcat on UNIX, Linux or Ubuntu then set a classpath to it. The command to run on command prompt is CLASSPATH = /appRoot/WEB-INF/lib or add this line to your .bashrc file. The way to reach this file is to go root and try this command – vi .bashrc, this file opens up in vi editor. If you have another text editor then try to open this file using that application so that it becomes easier for you to edit it. You can try with this class Class.forName("COM.ibm.db2.jcc.DB2Driver"); instead of Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); because it works for me. If you get this “COM.ibm.db2.jdbc.app.DB2Driver” to work then please post your comment on it.
Most Popular Articles
- Installing JDBC Driver for DB2 and Tomcat
- Ubuntu USB Problem
- Ubuntu Sound Problem
- Ubuntu Wireless Problem
- Ubuntu Flash Problem
Is Ubuntu Better Than Vista >>
<< Tips on Fixing Ubuntu Flash Problems
COMMENT
Name: Sandeep
Thanks a lot
Name: sebasto
Old Post, but I’m just searching something else when I read your article.
I can answer for COM.ibm.db2.jdbc.app.DB2Driver class.
This class requires a DB2 Client (or Server, or Connect) to be installed and running in order to work, as it relies on native libraries.
In older versions of DB2 (from 5.2 to 8.2), there was a COM.ibm.db2.jdbc.net.DB2Driver class called "lightweight" driver, which do not rely on native libraries, and thus works without any DB2 software on the tomcat box.
The big default of the .net Driver was the necessity to be at the same version level than the targeted DB2 server. With the "new" COM.ibm.db2.jcc.DB2Driver, you just have to be "reasonably" close of the targeted database.
Another good driver for managing Datasources is the com.ibm.db2.jcc.DB2XADataSource , high-end type 4 JDBC driver, with fine controls of the connection pool.
Just in case...