Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- class STable
- {
- public static void main(String args[]) throws Exception
- {
- Class.forName("com.mysql.jdbc.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/VCE","root","eswecha");
- Statement st=con.createStatement();
- ResultSet Rs=st.executeQuery("select * from student");
- while(Rs.next())
- {
- System.out.println("student name="+Rs.getString(1));
- System.out.println("student roll no="+Rs.getInt(2));
- }
- con.close();
- st.close();
- }
- }
Add Comment
Please, Sign In to add comment