<%@page import="java.sql.*"%> <%! Connection con=null; PreparedStatement pst=null; ResultSet rs=null; %>
 
<% try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/sandeep","sandeepguleria","guleriasandeep"); pst=con.prepareStatement("select * from news"); rs=pst.executeQuery(); out.println("

"); while(rs.next()) { out.println(""); out.println(""); } } catch(Exception e) { out.println("exception is:=="+e); } out.println("
"+rs.getString(2)+"
"+rs.getString(3)+"
"); %>