Mike Burdette wrote:
                                String sqlString2 =
                                        "SELECT * FROM "
                                                + rs.getString("COMPLIB"
).trim()
                                                + "."
                                                + "SOMPFM03 WHERE ACCTNMBR 
= '"
                                                + rs.getString("ACTNBR"
).trim()
                                                + "'";
                                PreparedStatement stmt2 =
                                        conn.prepareStatement(sqlString2, 
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                                ResultSet rs2 = stmt2.executeQuery();

                                if (!rs2.next()) {
                                        recCount++;
                                }

                        }

Don't create a new PreparedStatement stmt2 each time you loop.  Create
it once and update the parameters, or close the statement before you
create a new one.

Actually, you aren't even using PareparedStatement's correctly in this
case ... for what you are doing, a simple Statement would suffice
(closing it after you're done, of course).

Prepared statements are used when you are performing the same SQL
statement over and over, and all you need to do is change values in the SQL.

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.