top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the limitation of PreparedStatement in java and how to overcome it?

0 votes
1,088 views
What is the limitation of PreparedStatement in java and how to overcome it?
posted Jan 21, 2018 by Frank Lee

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

One of the limitation of PreparedStatement is that we can’t use it directly with IN clause statements. Some of the alternative approaches to use PreparedStatement with IN clause are:

Execute Single Queries – very slow performance and not recommended
Using Stored Procedure – Database specific and hence not suitable for multiple database applications.
Creating PreparedStatement Query dynamically – Good approach but looses the benefit of cached PreparedStatement.
Using NULL in PreparedStatement Query – A good approach when you know the maximum number of variables inputs, can be extended to allow unlimited parameters by executing in parts.

answer Jan 29, 2018 by Ammy Jack
...