Guest User

Untitled

a guest
Feb 25th, 2019
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.sql.*;
  2. class STable
  3. {
  4. public static void main(String args[]) throws Exception
  5. {
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/VCE","root","eswecha");
  8. Statement st=con.createStatement();
  9. ResultSet Rs=st.executeQuery("select * from student");
  10. while(Rs.next())
  11. {
  12. System.out.println("student name="+Rs.getString(1));
  13. System.out.println("student roll no="+Rs.getInt(2));
  14. }
  15. con.close();
  16. st.close();
  17. }
  18. }
Add Comment
Please, Sign In to add comment