Skip to content
Advertisement

SQL Error Invalid column when using java servlet [closed]

This is my main page

Main_page

and for some reason I can search list by title, but I cannot get all list. The button param is readable as I’ve already checked. This is my code for getting all book the list in servlet:

JavaScript

This is my get all book code:

JavaScript

This is my search book by title code:

JavaScript

Here are my constants:

JavaScript

I’m showing the get by title one because that code is perfectly fine. Then, as you can see, the result set part in both method is completely the same, so there’s no problem with the result part. So, I went to check in the DB. This is my table create:

JavaScript

And my SQL query is not wrong check_get_all_query. Therefore, I can only think that the part that was wrong is the Quantity condition part. So, I try putting the value directly in the string rather than using setInt statement:

JavaScript

The result is the same. So… I’m stuck. The log keeps showing that I have this error:

BookMarketController SQL: Invalid column name ‘Quantity’.

Can someone tell me why?

Advertisement

Answer

You have missed a space after Status" so there is a StatusFrom column.

Use bind variables and a space at start of continuation lines:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement