Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : testdatabase
- Created on : Sep 25, 2015, 11:42:06 AM
- Author : Krishnan
- --%>
- <%@ page import="java.lang.*" %>
- <%@ page import="java.sql.*" %>
- <%@ page import="java.io.*" %>
- <%! Connection con=null; %>
- <%! Statement st= null; %>
- <%! ResultSet rs= null; %>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- </head>
- <body>
- <%
- try
- {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbuitmjasin?user=root&password=");
- st = con.createStatement();
- rs = st.executeQuery("select * from usermaster");
- while(rs.next()) {
- String name = rs.getString("username");
- out.println("<p>" + name );
- } // end of whilee
- rs.close();
- st.close();
- con.close();
- }catch(SQLException e)
- {
- e.printStackTrace();
- }
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement