Comment on Tutorial - JSP Example to connect to MS SQL database and retrieve records By Abinaya

Comment Added by : Harshal

Comment Added at : 2013-02-19 14:56:35

Comment on Tutorial : JSP Example to connect to MS SQL database and retrieve records By Abinaya
I am getting a blank page. Closed the table tag and added the headers. Below is the modified code. Please let me know what is the issue with this?

<head><title>Enter to database</title></head>
<table border="5">
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*;" %>

java.sql.Connection con;
java.sql.Statement s;
java.sql.ResultSet rs;
java.sql.PreparedStatement pst;


// Remember to change the next line with your own environment
String url=
String id= "sa";
String pass= "password";

con = java.sql.DriverManager.getConnection(url, id, pass);

}catch(ClassNotFoundException cnfex){

//String sql = "select * from tbl_sys_user";
String sql = "select top 10 * from tbl_sys_user";
s = con.createStatement();
rs = s.executeQuery(sql);

while( ){

<th>Header 1
<td><%= rs.getString("cust_id") %></td>

<th> Header 2
<td><%= rs.getString("rdate") %></td>

<td><%= rs.getString("email") %></td>


catch(Exception e){e.printStackTrace();}
if(rs!=null) rs.close();
if(s!=null) s.close();
if(con!=null) con.close();


View Tutorial

Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. excellent..... thanks it help me a lot.......
View Tutorial          By: REJAPUTRA at 2009-10-23 09:19:25

2. I want full information about Java & Data Stru
View Tutorial          By: s.karthick at 2015-05-07 05:32:24

3. we want to learn j2me
View Tutorial          By: vijay at 2010-09-27 02:34:59

4. Hi, my name is Jaime,
I wan't to do a jsp w

View Tutorial          By: Jaime at 2011-10-24 12:47:50

5. thanks , but i want it some thing like fibonici se
View Tutorial          By: Arpit Agrawal at 2015-01-04 18:34:41

6. Hi Robert,

The precision statement

View Tutorial          By: George at 2015-01-31 06:25:18

7. Thanks a ton!!! It was really very useful :)
View Tutorial          By: Ankit at 2015-05-11 12:30:41

8. For Jaime,

Maybe using JavaScript f

View Tutorial          By: Jair Aviles at 2011-11-22 05:49:05

9. everything is easy to learn from your website.I un
View Tutorial          By: sumitra barua at 2012-05-30 03:13:10

10. i have an exception unknown host.
please te

View Tutorial          By: saddam hussain at 2011-03-22 10:46:48