In PreparedStatement you cannot use direct queries with IN (input) parameters. There are some workarounds: Run Single Queries – low performance and generally not recommended to do. Use Stored Procedures (stored procedures) – are specific to a specific database and therefore are bad for applications with the ability to connect to different databases. Creating a PreparedStatement Query dynamically is a good solution, but with the loss of PreparedStatement caching. Using NULL in PreparedStatement Query is a good solution if you know the maximum number of IN variables. You can expand to use an unlimited number of parameters by splitting them into parts.