Results 1 to 15 of 15
  1. #1
    Join Date
    Jan 2012
    Posts
    7

    Unanswered: error connecting db2-class not found exception

    Hi,
    I tried connecting jsp file developed using eclipse to DB2 database using apache tomcat server.I get error as:java.lang.ClassNotFoundException: COM.ibm.db2.jcc.DB2Driver.
    Please help me in solving this issue.

    Thank You
    Madhu

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Do you have the following, executed before you connect?

    Code:
    Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
    Andy

  3. #3
    Join Date
    Jan 2012
    Posts
    7

    com.ibm.db2.jcc.c.DisconnectException error

    Hi,
    After using the code -Class.forName("com.ibm.db2.jcc.DB2Driver").newInst ance();.The class exception error has been solved but,
    Now i am getting another error-

    com.ibm.db2.jcc.c.DisconnectException: [ibm][db2][jcc][t4][2030][11211] A communication error has been detected. Communication protocol being used: TCP/IP.
    Communication API being used: SOCKETS. Location where the error was detected: Reply.fill().
    Communication function detecting the error: InputStream.read(). Protocol specific error codes Insufficient data, * , 0. Message: null.

    Please help me in solving this error.

    Thank You
    Madhu

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Can you post the java code that contains, in order, all the JDBC calls, and which one is getting the error?

    Andy

  5. #5
    Join Date
    Jan 2012
    Posts
    7

    java code

    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.sql.*" %>
    <%
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;



    String name=request.getParameter("Donor_Name");

    String emailid=request.getParameter("Email_id");

    String password=request.getParameter("Password");

    String occupation=request.getParameter("Occupation");


    String address=request.getParameter("Address");

    String state=request.getParameter("State");

    String city=request.getParameter("City");


    String area=request.getParameter("Area");








    String bloodgroup=request.getParameter("Blood_group");







    try{


    Class.forName("COM.ibm.db2.jcc.DB2Driver ");

    con = DriverManager.getConnection("jdbc:db2://localhost:8080/IBM_TGMC","","");


    stmt=con.createStatement();



    stmt.executeUpdate("insert into USER_REGISTRATION( DONAR NAME, EMAIL ID,PASSWORD,OCCUPATION,DOB,ADDRESS,STATE,CITY,AREA ,CONTACT_NO,BLOOD GROUP,HEIGHT,WEIGHT,LAST DONATED) values('"+name+"','"+emailid+"','"+password+"','"+ occupation+"','"+address+"','"+state+"','"+city+"' ,'"+area+"','"+bloodgroup+"')");
    con.close();
    out.println("Data is successfully inserted into database");
    }
    catch(Exception e){
    System.out.println(e);

    }
    %>

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Are you sure your DB2 instance uses port 8080? Quite an unusual choice.

  7. #7
    Join Date
    Jan 2012
    Posts
    7

    com.ibm.db2.jcc.c.SqlException

    Hi,
    8080 is the apache tomcat server port no..
    The error seems to have been solved after i relaunched the eclipse.
    Now i have another error:
    com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704

    Please help me in solving this error

    Thank You
    Madhu

  8. #8
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Code:
    SQL0204N  "<name>" is an undefined name.
    
    Explanation:
    
    This error is caused by one of the following:
    
    *  The object identified by "<name>" is not defined in the database.
    *  The data partition identified by "<name>" is not defined on the
       table.
    *  A data type is being used. This error can occur for the following
       reasons:
       *  If "<name>" is qualified, then a data type with this name does not
          exist in the database.
       *  If "<name>" is unqualified, then the user's path does not contain
          the schema to which the desired data type belongs.
       *  The data type does not exist in the database with a create
          timestamp earlier than the time the package was bound (applies to
          static statements).
       *  If the data type is in the UNDER clause of a CREATE TYPE
          statement, the type name may be the same as the type being
          defined, which is not valid.
    
    *  A function is being referenced in one of:
       *  a DROP FUNCTION statement
       *  a COMMENT ON FUNCTION statement
       *  the SOURCE clause of a CREATE FUNCTION statement
    
          If "<name>" is qualified, then the function does not exist. If
          "<name>" is unqualified, then a function of this name does not
          exist in any schema of the current path.
    
    
    
          Note that a function cannot be sourced on the COALESCE,
          DBPARTITIONNUM, GREATEST, HASHEDVALUE, LEAST, MAX (scalar), MIN
          (scalar), NULLIF, RID, NVL, RAISE_ERROR, TYPE_ID, TYPE_NAME,
          TYPE_SCHEMA, or VALUE built-in functions.
    
    *  The element named "<name>" is used on the right side of the UNDER
       clause in CREATE SECURITY LABEL COMPONENT statement but has not yet
       been defined as being ROOT or being UNDER some other element
    *  The security label component element named "<name>" has not yet been
       defined.
    *  One of the following scalar functions specified a security policy
       identified by "<name>" which is not defined in the database.
       *  SECLABEL
       *  SECLABEL_TO_CHAR
       *  SECLABEL_BY_NAME
    
    This return code can be generated for any type of database object.
    
    Federated system users: the object identified by "<name>" is not defined
    in the database or "<name>" is not a nickname in a DROP NICKNAME
    statement.
    
    Some data sources do not provide the appropriate values for "<name>". In
    these cases, the message token will have the following format:
    "OBJECT:<data source> TABLE/VIEW", indicating that the actual value for
    the specified data source is unknown.
    
    The statement cannot be processed.
    
    User response:
    
    Ensure that the object name (including any required qualifiers) is
    correctly specified in the SQL statement and it exists. If the name
    refers to a data partition, query the catalog table
    SYSCAT.DATAPARTITIONS to find the names of all the data partitions for a
    table. For missing data type or function in SOURCE clause, it may be
    that the object does not exist, OR it may be that the object does exist
    in some schema, but the schema is not present in your path.
    
    For the CREATE or ALTER SECURITY LABEL COMPONENT statement, make sure
    that each element specified as a reference element value for positioning
    the location of a new element value already exists in the security label
    component.
    
    For the CREATE SECURITY LABEL COMPONENT statement, make sure that each
    element is specified as either ROOT or as the child in an UNDER clause
    before specifying it as the parent in an UNDER clause.
    
    For the scalar functions SECLABEL, SECLABEL_TO_CHAR or SECLABEL_BY_NAME,
    ensure that a valid security policy was specified for the argument
    security-policy-name.
    
    Federated system users: if the statement is DROP NICKNAME, make sure the
    object is actually a nickname. The object might not exist in the
    federated database or at the data source. Verify the existence of the
    federated database objects (if any) and the data source objects (if
    any).
    
    sqlcode: -0204
    
     sqlstate: 42704
    All of this is available in the DB2 manuals.

    Andy

  9. #9
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by madhu9124 View Post
    8080 is the apache tomcat server port no..
    Clearly, it should be the DB2 instance port number. I think you should start reading manuals.

  10. #10
    Join Date
    Mar 2012
    Posts
    3
    hi,
    I have tried both of the urls:
    Class.forName("com.ibm.db2.jcc.DB2Driver").newInst ance();
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").ne wInstance();

    but each time it generates errors..
    please help me

    javax.servlet.ServletException: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    org.apache.jasper****ntime.PageContextImpl.doHandl ePageException(PageContextImpl.java:911)
    org.apache.jasper****ntime.PageContextImpl.handleP ageException(PageContextImpl.java:840)
    org.apache.jsp.klkl_jsp._jspService(klkl_jsp.java: 124)
    org.apache.jasper****ntime.HttpJspBase.service(Htt pJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:433)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)


    root cause

    java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    java.lang.Class.forNameImpl(Native Method)
    java.lang.Class.forName(Class.java:139)
    org.apache.jsp.klkl_jsp._jspService(klkl_jsp.java: 84)
    org.apache.jasper****ntime.HttpJspBase.service(Htt pJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:433)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)

  11. #11
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Do you have db2jcc.jar / db2jcc4.jar in your CLASSPATH ?
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  12. #12
    Join Date
    Mar 2012
    Posts
    3
    thanx for reply.. i have resolved that problem but now another error is there..
    please help


    i have defined all class paths.. but getting this error when displaying db2 table contents on browser.
    (i guess problem is arising due to "sqlj.zip/sqlj4.zip" folders provided with jdbc download, but dont know what to do with this )
    please reply
    .................................................. ...........................................
    javax.servlet.ServletException: java.sql.SQLException: No suitable driver
    org.apache.jasper****ntime.PageContextImpl.doHandl ePageException(PageContextImpl.java:911)
    org.apache.jasper****ntime.PageContextImpl.handleP ageException(PageContextImpl.java:840)
    org.apache.jsp.dudy_jsp._jspService(dudy_jsp.java: 130)
    org.apache.jasper****ntime.HttpJspBase.service(Htt pJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:433)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:668)




    is it fine ? (see my screenshot )
    Attached Thumbnails Attached Thumbnails ScreenHunter_14 Mar. 31 18.44.jpg  
    Last edited by yogesh29010; 03-31-12 at 10:21.

  13. #13
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by yogesh29010 View Post
    javax.servlet.ServletException: java.sql.SQLException: No suitable driver
    This most likely means that your JDBC URL scheme does not match the driver that you load. Since you didn't show either, I can only wish you good luck with further troubleshooting.

  14. #14
    Join Date
    Mar 2012
    Posts
    3
    it worked when i have re-started WAS, dont know why i need to re-start server every time.

    thanks a lot for replying, and one more problem i am facing:
    I have imported a netbeans web project (.war) in eclipse indigo, it gives lots of error in html code, though it was full functional at netbeans.
    when i run it on server it gives error:
    this status has children statuses... help me.. how to overcome this.
    i have many .JS and .CSS and folders in Web Content directory in my project..

    please reply..
    thank

  15. #15
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    well, this is not a java/netbeans/eclipse forum. Find one to post this question

    =
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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