I am trying to connect to a remote DB2 database located on a server. I have made the necessary DSN connection using ODBC and the test was successful. So in the below code i am using IMRM2 which is my DSN name, is that correct ?
But my main problem is i am getting the below error even after adding db2jcc.jar, db2jcc_license_cu.jar to my eclipse library. ?
Error:
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at ConnectToDb2.makeConnection(CreateChart.java:19)
    at CreateChart.main(CreateChart.java:63)
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
    at java.util.zip.ZipFile.read(Native Method)
    at java.util.zip.ZipFile.access$1400(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
    at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at sun.misc.Resource.getBytes(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    ... 11 more
Java File.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
class ConnectToDb2{
    String jdbcClassName="com.ibm.db2.jcc.DB2Driver";
    String url="jdbc:db2:IMRM2";
    String user="db2inst1";
    String password="DB2";
    Connection connection = null;
        public void makeConnection()
        {   
            try 
            {   
                Class.forName(jdbcClassName);
                connection = DriverManager.getConnection(url, user, password);
            } 
            catch (ClassNotFoundException e) 
            {
                e.printStackTrace();
            } 
            catch (SQLException e) 
            {
                e.printStackTrace();
            }
            finally
            {
                if(connection!=null)
                {
                    System.out.println("Connected successfully.");
                    try 
                    {
                        connection.close();
                    }
                    catch (SQLException e) 
                    {
                        e.printStackTrace();
                    }
                }
            }//End of finally 
        } // End of method makeConnection
}
public class CreateChart {
    public static void main(String[] args) {
        ConnectToDb2 obj_connectdb2 = new ConnectToDb2();
        obj_connectdb2.makeConnection();
    }
}