FWiW - When I insert from i into a remote MS Sql table, I do >not< specify the
identity column in the INSERT column list, and, of course, there is no
parameter value for that column.
So, maybe:
INSERT INTO Cutsheet00 (col2, col3, col4) VALUES(?,?,?)
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Wednesday, February 15, 2012 12:11 PM
To: 'java400-l@xxxxxxxxxxxx'
Subject: prepared statement and identity column issue
I am writing a program a little java program that reads an ACCESS database and writes the records to a the I.
I had this program working, but then I decided to add an identity column to the database on the I.
Now I can't figure out how to get the records written.
Snippet of what I'm doing
pstmt= condb.prepareStatement("INSERT into Cutsheet00 VALUES (?,?,?,?)");
while (rs.next())
{
int order = rs.getInt(1);
String house = rs.getString(2);
String street = rs.getString(3);
pstmt.setInt(1,order);
if (house == null)
house = " ";
pstmt.setString(2,house);
pstmt.setString(3,street);
pstmt.executeUpdate();
}
File cutsheet00 has 4 fields, identity column, order, house, street) I have tried various combinations, but nothing I do lets me get the identity column added.
Thanks for any help
Mike
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the Java Programming on and around the IBM i (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.