Databases generally cannot use indexes if the indexed column is part of an expression. Usually not even if the expression is trivial.
In your case, just compute the first and last day of the quarter you're interested in and use a BETWEEN clause with these days. The result will be the same and it will use the index.
If the date column contains time as well, you cannot use BETWEEN. In this case, you need to compute the first day of the quarter in question and the first day of the immediately following quarter, and use a condition like this:
(And you should definitely use PreparedStatement for all your queries - here is why.)
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads