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