I am trying to connect to a MySQL database from a jsp page using jdbc in the backend.
I have the following code:
public static void insertIntoDatabase(String code,String name,String temp,String hum,String del) {
    Connection con = null;
    if (del.length() == 0) {
        del="no data";  
    }
    name = name.replaceAll("\\(.+?\\)", "");
    name = name.replaceAll(" ", "_");
    del = del.replaceAll(" ", "_");
    System.out.println("del "+del);
    String url = "jdbc:mysql://localhost:3306/test";
    try {
        Class.forName("com.mysql.jdbc.Driver");
        con = DriverManager.getConnection(url,"root","");
        con.createStatement().executeUpdate("CREATE TABLE IF NOT EXISTS aiportdetails(code VARCHAR(50) PRIMARY KEY, " +
                "name VARCHAR(250), temp VARCHAR(50), hum VARCHAR(50), del VARCHAR(50))");
        ResultSet rs = con.prepareStatement("SELECT * FROM airportdetails;").executeQuery();
    } catch (SQLException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } finally {
        try {
            if (con != null) {
                con.close();
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
}
I am getting the following error at
ResultSet rs = con.prepareStatement("SELECT * FROM airportdetails;").executeQuery();
error:
Table 'test.airportdetails' doesn't exist
But from my phpmyadmin I can see that the table is created and exists:
What is the reason I am getting this error?
 Thank you.