Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    1

    Unhappy Unanswered: please help me?about the jsp connect to DB2.

    Why view.jsp cannot run regularly?the error info:
    "Unable to load class com.ibm.db2.jdbc.app.DB2Driver"
    How can i do?


    view.jsp
    <%@ page import="java.sql.*"%>
    <%@ page contentType="text/html;charset=gb2312"%>
    <html>
    <head>
    <title>connect with Server</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body bgcolor="#FFFFFF" text="#000000"> <%

    Class.forName("com.ibm.db2.jdbc.app.DB2Driver").ne wInstance();
    String url="jdbc:db2:bbs";
    Connection con=DriverManager.getConnection(url,"administrator ","mememe");
    Statement statement=con.createStatement();
    String query="select * from user";
    ResultSet rs=statement.executeQuery(query);
    %>
    <%
    while(rs.next())
    {
    String a=rs.getString("name");
    String b=rs.getString("title");
    String c=rs.getString("content");
    %>

    <table width="272" border="0" cellspacing="0" align="center">
    <tr>
    <td bgcolor="#FFFFCC">
    <div align="center">lyb</div>
    </td>
    </tr>
    <tr>
    <td bgcolor="#00FFFF">name: <%=a%></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFCC">title: <%=b%></td>
    </tr>
    <tr>
    <td bgcolor="#00FFFF">content: <%=c%></td>
    <tr>
    <td> </td>
    </table>
    <%
    }
    %>
    </body>
    </html>

  2. #2
    Join Date
    Sep 2012
    Posts
    8
    did you import db2jcc.jar

  3. #3
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Everybody keeps telling me that javascript is NOT java. JDBC is java so I'm afraid it is not possible.
    See also How to connect jdbc with javascript (HTML, CSS and JavaScript forum at JavaRanch).
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

Posting Permissions

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