how to connect jsp page with the db2 database?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhanshubajaj89
    New Member
    • Aug 2010
    • 2

    #1

    how to connect jsp page with the db2 database?

    Code:
    @ page pageEncoding="UTF-8" %>
    <%@page contentType="text/html" %>
    <%@page session="false" %>
    <%@page import="java.sql.*" %>
    <%@page import="java.util.*" %>
    <html>
        <head>
            <title>emplolyees firstname</title>
        </head>
        <body>
            <%
             Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
             Connection con=DriverManager.getConnection("jdbc:db2:sample","","");
             String sql="SELECT firstnme from emp ";
             Statement st=con.createStatement();
             ResultSet rs= st.executeQuery(sql);
             while(rs.next())
              {
                 String firstname=rs.getString(1);
           %>
               <h5>
                  EMPLOYEES FIRSTNAME ARE :<%= firstname%>
               </h5>
               <br>
           <%
            }
            rs.close();
            rs=null;
            st.close();
            st=null;
            con.close();
           
    
          %>
          <br>
          <br>
          <b> THE END OF DATA</b>
        </body>
    </html>
    i did dis but the result is not coming wat is d problem..
    error report is :
    description:-The requested resource () is not available.
    Last edited by Niheel; Aug 16 '10, 07:36 PM.
Working...