You are on page 1of 1

import java.sql.

*;
public class data{
public static void main (String []arg)
{
try
{
class.for name("Sun.jdbc.odbc.Jdbcodbcdriver");
}
catch(classNotFoundException e)
{
System.out.println("Unable to load Driver Class");
return;
}
try
{
connection con = DriverManager.getconnection("jdbc: odbc: Amit "," "," ");
statement stuit = con.createstatement();
Result Set rs = stuit.executequery("Select Sname, mark FROM Student where mark
s>= 90");
while(rs.next()){
System.out.println(rs.getstring ("Sname")+" ");
System.out.println(rs.getstring ("marks"));
}
r.s close();
stuit.close();
con.close();
}
catch(SQLException Se)
{
System.out.println("SQLException: "+Se.getMessage());
Se.printstackTrace (System.out);
}
}
}

You might also like