Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Unanswered: Please help me to solve this COM.ibm.db2.jdbc.app.DB2Driver error?

    Friends I'm using Rational application developer 7.0 and db2express c. I connected the database in RAD using new data connection wizard. I imported db2jcc.jar file too. I'm using Websphere application server community edition.
    But while running the page this error displayed in every page.

    ERROR : COM.ibm.db2.jcc.DB2Driver

    I built the path too. My coding is as follows

    <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" %>
    <%
    try
    {
    Class.forName("COM.ibm.db2.jcc.DB2Driver");
    Connection con = DriverManager.getConnection("jdbc:db2:d1");
    String username,password,usertype,query;
    ResultSet rs=null;
    PreparedStatement ps=null;
    username = request.getParameter("username");
    password=request.getParameter("password");
    usertype=request.getParameter("usertype");
    query="select * from login where username='"username"'and usertype="usertype"";
    ps=con.prepareStatement(query);
    rs=ps.executeQuery();
    if (rs.next())
    {
    if (rs.getString("password").equals(password))
    {

    session.setAttribute("userid", rs.getString("userid"));
    session.setAttribute("usertype", rs.getString("usertype"));
    session.setAttribute("loginstatus", "1");

    if(rs.getString("userid").equals("0"))
    {
    %>
    <jsp:forward page="adminhome.jsp"></jsp:forward>
    <%

    }
    if(rs.getString("usertype").equals("2"))
    {

    String query1="select designation from emp_work_profile where userid="session.getAttribute("userid")"";
    ResultSet rs1=null;
    PreparedStatement ps1=null;
    ps1=con.prepareStatement(query1);
    rs1=ps1.executeQuery();
    while(rs1.next())
    {
    session.setAttribute("empdesig",rs1.getString("des ignation"));

    if(rs1.getString("designation").equals("6")||rs1.g etString("designation").equals("7"))
    {
    %>
    <jsp:forward page="ration/rationhome.jsp"></jsp:forward>
    <%
    }
    else {%>
    <jsp:forward page="employee/employeehome.jsp"></jsp:forward>
    <% }

    }

    }
    if(rs.getString("usertype").equals("1")) {
    %>
    <jsp:forward page="citizenhome.jsp"></jsp:forward>
    <%}
    if(rs.getString("usertype").equals("3")) {
    %>
    <jsp:forward page="hospital/hospital_main.jsp"></jsp:forward>
    <%}
    if(rs.getString("usertype").equals("4")) {
    %>
    <jsp:forward page="schoolhome.jsp"></jsp:forward>
    <%}
    }
    else
    {
    %>
    <jsp:forward page="wronguser.jsp"></jsp:forward>
    <%

    }
    }
    else
    {
    %><jsp:forward page="wronguser.jsp"></jsp:forward><%
    }
    con.close();
    }
    catch(Exception e)
    {
    out.println("Error "+e.getMessage());
    }

    %>

    Please solve this error. i'll be thankful to you all

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Hmm.. this javascript right? Dunno about that. When it were java I'd say:
    take this code as an example Java Program Name for DB2 | db2ude
    there are 3 'crititcal' things going on in 1 try/catsch block. Why not not 3 of those blocks:
    1 for the class-load
    1 for the connect
    1 for the query
    This makes it more easy to pinpoint the error.

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    It would also help if you had more diagnostic information about the error.

    Andy

  4. #4
    Join Date
    Apr 2005
    Location
    USA
    Posts
    130
    Looks to me you are missing the jar files. In RAD did you specify correct SQLLIB path of DB2. BTW what version of DB2 and it's OS.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •