i am using the following query to pull selected data
String fetch_head = "select * from head_category where id = (?)";
but i don't know how to pull row by ResultSet and supply parameter using PreparedStatement same time.
public ArrayList fetch_selected() {
ArrayList arrayList = new ArrayList();
try {
connectionFactory cf = new connectionFactory();
con = cf.getcon();
st = con.createStatement();
rs = st.executeQuery(fetch_head);
while (rs.next()) {
// it only fetches all
}
} catch (Exception e) {
e.printStackTrace();
}
return arrayList;
}
Now where do I put the PreparedStatement...?