I connected jsp with mysql. i m beg. level programmer in JSP. So, plz dont comment on my code writing style, bt plz help me to improve ma programming. I can execute query bt whn i try RESULTSET to retrive, getting error.
my code is below :
<%@page import = "java.sql.* "%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%! Connection Db;
ResultSet rs;
Statement Dr;
String query, pass, typ,pnt,user;
%>
<%
Class.forName ("com.mysql.jdbc.Driver");
Db = DriverManager.getConnection("jdbc:mysql://localhost/bug_track", "root","root");
query= "Select * from login" ;
Dr = Db.createStatement();
rs=Dr.executeQuery(query);
do {
user = rs.getString(1);
pass = rs.getString(2);
typ = rs.getString(3);
pnt = user + " " +pass+" "+typ;
%>
<p> <%=pnt%> </p>
<%
}while(rs.next());
%>
</body>
</html>