I have a database called 'airplane' inside which there is a table named timetable . The timeatable table has a column fromcity of text type
Connection conn0=null;
PreparedStatement st0=null;
String sql0="SELECT FROM timetable where fromcity=?";
try{
Class.forName("com.mysql.jdbc.Driver");
conn0=DriverManager.getConnection(DB_URL,USER,PASS);
st0=conn0.prepareStatement(sql0);
st0.setString(1,city[i]);
ResultSet rs0=st0.executeQuery();
if(rs0.next())
{
System.out.println("flight exists");
}
else
{
System.out.println("fight does not exist");
}
}
catch(Exception et)
{
System.out.println("Error"+et.getMessage());
}
I am getting the error:
why am I getting this error
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM timetable where fromcity='1'' at line 1