I am trying to get the role variable from the Database, I am getting error that "Unhandled exception type SQL Exception"
static int indexValue=0;
public static int getRole(IndexBean w){
String elid= IndexBean.getId();
conn = ConnectionProvider.getCon();
Statement statement = conn.createStatement();
ResultSet resultset = statement.executeQuery("SELECT role FROM users WHERE elid = '" + elid + "'") ;
String role = resultset.getString(1);
if(role=="ADMIN"){
indexValue = 1;
}else if(role=="analyst"){
indexValue = 2;
}
conn.close();
return indexValue;
}
}