http://www.regdeveloper.co.uk/2006/09/22/jse_bling/  

I want to be able to do something like I can do in the Oracle ‘C’ preprocessor:

EXEC SQL FOR :count
INSERT INTO FRED (FRED_ID)
VALUES (:a_fred_id);

where count says how many and the a_fred_id variable is an array. I know this is pre-processed code but it is available in the non-pre-processed environments as well. Obviously there is syntax for bulk fetching as well.

The current JDBC junk, where you fetch each record one at a time, has always seemed to me to have too much Microsoft/whoever ODBC heritage; everything is talking to Access on the same DOS machine.

Last time I looked into this they did allow you to send multiple statements, which was OK but so what? Array binding is genuinely useful and if too hard to implement for a given SQL engine then throw an exception saying so.

Many years ago a colleague did the array binding in C++ and then linked these C++ objects into Java. This was a factor of 10 (or maybe more) times faster than JDBC. If you are retrieving a list of, say, order lines, why on earth would you want them one at a time anyway? If you are retrieving a list of big XML documents again, you want them in the most network-efficient manner.

My opinion – and someone will doubtless tell me there is a way to do this, probably using Business Delegates which pass arrays back – fine, but why can’t I have the whole array straight from the database in the first place?