Guest User

Untitled

a guest
Oct 11th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package main;
  2.  
  3. import java.sql.*;
  4.  
  5. public class Connectionclass {
  6.  
  7. public static void main(){
  8. try{
  9. Class.forName("com.mysql.jdbc.Driver");
  10. Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/sakila","root","root");
  11. Statement stmt= con.createStatement();
  12. ResultSet rs=stmt.executeQuery("select * from actor");
  13. while(rs.next())
  14. System.out.println("Hello"+rs.next());
  15. con.close();
  16. }
  17. catch(Exception e)
  18. {
  19. System.out.println(e);}
  20. }
  21.  
  22. }
Add Comment
Please, Sign In to add comment