sql query? What is wrong with this?
High everyone. I was trying to solve problem with jsp-servlet combination. I nailed the problem down to the last point, but surprisingly I got an error message which is completely out of any reason.
Here is the problem. Im using tomcat 5.5 and MySql DB.
I've got a servlet with a method that returns ID of the member according to his name. Here is the relevant code:publicstaticint getMemberID (String name){
int id = 5;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
.
.
ResultSet rs = st.executeQuery("select MemberID from member where MemberName =" + name);
if (rs!=null && rs.next()){
id = rs.getInt("MemberID");
st.close();
conn.close();
}
}
I call this method from the JSP:
<% int a = ThreadMembers.getMemberID("Merlin");.....
Now what happens...I got the SQL exception message:
Unknown column 'Merlin' in 'where' clause !?!?!
Of course I checked my database and tried the same query manually, everything is OK. There are only two records in my member table.
And, just in case, I entered manually the next query:
select MemberID from member where Merlin = 'Merlin':)
and of course got the same error message.
I would really like to hear if anybody had similar problem, or is able to explain what's going on here.
Thank you

