Guest User

Untitled

a guest
Mar 9th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.PreparedStatement;
  4. import java.sql.ResultSet;
  5.  
  6.  
  7. public class Main
  8. {
  9.  
  10. public static void main(String[] args) throws Exception
  11. {
  12. Class.forName("com.mysql.jdbc.Driver");
  13.  
  14. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Login System","root","");
  15. PreparedStatement statement = con.prepareStatement("select * from `Login System` `name`");
  16. ResultSet result = statement.executeQuery();
  17.  
  18. while(result.next())
  19. {
  20. System.out.println(result.getString(1) + " " + result.getString(2));
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment