Guest User

Untitled

a guest
Sep 23rd, 2017
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. class Crud {
  4. public static void main(String args[]) {
  5. try {
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/flight_booking_system",
  8. "root", "1234");
  9. Statement stmt = con.createStatement();
  10. ResultSet rs = stmt.executeQuery("select * from emp");
  11. while (rs.next())
  12. System.out.println(rs.getInt(1) + " " + rs.getString(2));
  13. con.close();
  14. } catch (Exception e) {
  15. System.out.println(e);
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment