× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I thought the limit for any SQL array operation was 32766.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Wednesday, December 17, 2008 11:12 AM
To: Java Programming on and around the iSeries / AS400
Subject: Re: Block Insert fails...

Hi Kieth,

As mentioned in my other post, I got it working with batches of 5,000
and turning auto-commit off.

I went back and tried to do all 44,000 as a single batch, and the
process fails with the same error I originally received.

So, there does appear to be some limit.

In any event, I'm definitely impressed by the performance. I'm
inserting 44,000 rows in less than 10 seconds.


Charles

On Wed, Dec 17, 2008 at 11:09 AM, Keith McCully
<keithmccully@xxxxxxxxxxxxxx
wrote:

Hi Charles,

I've used block inserts using PreparedStatement methods addBatch() and
executeBatch() similar to you and it worked ok - although I used
hundreds rather than thousands of inserts. I've never seen a reference

to a batch size limitation.

Does rerun with fewer insert records work?

What driver are you using - does it support batch statements?

Also, try returning the executeBatch to an integer array - to check
the success or failure of each insert:

int[] upCounts = ps.executeBatch();

44,000 elements is a bit much but you could run on a smaller scale.

Regards,

Keith




2008/12/17 Charles Wilt <charles.wilt@xxxxxxxxx>

So nobody has any thoughts on this?

Is anybody out there using block inserts?

Thanks!
Charles

On Tue, Dec 16, 2008 at 9:08 AM, Charles Wilt
<charles.wilt@xxxxxxxxx
wrote:

All,

I've got the following code, in a Java program I'm running from
QShell

try {
Statement stmt = sqlConn.createStatement();
ResultSet rs = stmt.executeQuery("select select
varchar05, intfld, varchar02 " +
" from
CINTAS.cadmin.sometable");

PreparedStatement ps = i5Conn.prepareStatement("INSERT

INTO CINTASDTA.INACTCAB VALUES(?,?,?)");

while (rs.next()) {
ps.setString(1,rs.getString(1));
ps.setLong(2,rs.getLong(2));
ps.setString(3,rs.getString(3));
ps.addBatch();
}

ps.executeBatch();

} catch (SQLException e) {
System.out.println(e.getMessage());
}
}

When the "use block insert" property is set to true, it fails with

a
message:
"Error occurred in SQL Call Level Interface - HY009 "

There's a job log created which has the following:
SQ99999 Diagnostic 30 12/16/08 08:53:35.935112
QSQCLI QSYS *STMT QJVAJDBC QS
From module . . . . . . . . :
SQLPO
From procedure . . . . . . :
SQLParamOptions
Statement . . . . . . . . . :
4742
To module . . . . . . . . . :
QJVACLII
To procedure . . . . . . . :
JDBCParamOptions
Statement . . . . . . . . . :
4
Message . . . . : Error
occurred
in
SQL Call Level Interface
Cause . . . . . : A
procedure
call
encountered an error. The error code is
9. Error codes are: 3 --
Program type out of range. 4 -- SQL data type out
of range. 9 -- Argument
value
not
valid. 10 -- Function sequence error. 12

If I change "use block insert" to FALSE, it works fine.

Also, I can leave "use block insert" to TRUE and have it work if
instead
of
batching the inserts, I do them one at a time:
try {
Statement stmt = sqlConn.createStatement();
ResultSet rs = stmt.executeQuery("select varchar05,
intfld,
varchar02 " +
" from
CINTAS.cadmin.sometable");

PreparedStatement ps = i5Conn.prepareStatement("INSERT

INTO CINTASDTA.INACTCAB VALUES(?,?,?)");

while (rs.next()) {
ps.setString(1,rs.getString(1));
ps.setLong(2,rs.getLong(2));
ps.setString(3,rs.getString(3));
ps.executeUpdate();
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}

But I think when the inserts are not batched they are not blocked
either...

Does anybody know what I'm doing wrong?

There's just over 44,000 rows being inserted, perhaps that's to
many
for
one batch?

Thanks!
Charles Wilt




--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take

a moment to review the archives at
http://archive.midrange.com/java400-l.


--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email:
JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a

moment to review the archives at
http://archive.midrange.com/java400-l.


--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.