source file name:  JdbcSelect.java

 import java.sql.*;

class JdbcSelect

 {

public static void main(String[] args)

{

System.out.println("jdbc program");

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection conn = DriverManager.getConnection("jdbc:odbc:javadsn");

Statement st = conn.createStatement();

String s="select * from student";

ResultSet rs=st.executeQuery(s);

while(rs.next())

{

System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));

}

conn.close();

st.close();

}

catch(Exception e1)

{System.out.println(e1);}

}

}


output: