Ashish,PrepareStatement is quite expensive and only needed if you either have ?-placeholders or want to repeat it _MANY_ times. The value for _MANY_ varies from database to database, but I believe it was between 20 and 50 for Oracle some years ago.
Instead of using place markers to "hold a spot" for a variable number of
values, you could build the entire SQL statement, including the actual
values, and then prepare that statement and execute it.
sqlStatement = "select * from mytable where line in (";
sqlStatement = sqlStatement + "'ABC',";
// Repeat previous statement for each value you need to check for. The last
value should not include the trailing comma after the close single-quote.
sqlStatement = sqlStatement + ")";
Then just prepare that statement and execute it.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.