abhinavM 0 Newbie Poster

I have this servlet code for retrieving contents from database and displaying it on the browser.But when I am running this code it is giving "ClassNotFound Exception" at Class.forname().I have built the path with db2jcc.jar and db2jcc_license.jar file but still this exception is thrown.Please help me

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import java.sql.Connection;
import java.sql.Statement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.*;



/**
 * Servlet implementation class HelloServlet
 */
public class HelloServlet extends HttpServlet {
	
	public Statement statement;
	public Connection connection;
	
	
	private static final long serialVersionUID = 1L;
       
	
    /**
     * @see HttpServlet#HttpServlet()
     */
    public HelloServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    
    
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		

	PrintWriter out=response.getWriter();
	out.print("dkfjdkfjdkjfd");
	     
	     // Statement statement = null;
	  
	      ResultSet rs = null;
	    System.out.println("loading class") ;
	    
	      try {
			Class.forName("com.ibm.db2.jcc.DB2Driver");//Exception thrown
			System.out.println("abcd");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	      
	System.out.println("after loading class"); 
	 
	      try {
			connection  = DriverManager.getConnection("jdbc:db2://localhost:50000/Simple","administrator","welcome2sa2");                       //Exception thrown
		System.out.println(connection.getClass());
	      } catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	  System.out.println("after conncetion class");
	     try {
		 statement = connection.createStatement(); //Exception thrown
		 System.out.print("abcd");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


	       
	      String QueryString = "select * from question";
	                                                   
	      try {
			rs = statement.executeQuery(QueryString);
			while(rs.next()){
				for(int i=1;i<=6;++i)
					out.print(rs.getString(i)+"\t");
	
			}
					} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// TODO Auto-generated method stub
	}


}