MDH
MDH

Reputation: 21

Spring JdbcTemplate batchUpdate issue always returning -3

I am trying to use the batchUpdate on Springs jdbcTemplate but all i'm getting back is an int array of -3's. Below is the code I'm running. The array list "batch" contains inserts and updates.

String[] stmts = batch.toArray(new String[batch.size()]);
int[] result = jdbcTemplate.batchUpdate(stmts);

The result array contains [-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, ... ]

Using - Spring 3.1.2.RELEASE - jtds driver 1.3.0 - SQL Server 2005

Has anyone come across this?

Upvotes: 1

Views: 469

Answers (1)

MDH
MDH

Reputation: 21

It was found that batchUpdate does not like comments in the sql it is given. Once the comments were removed the update worked fine.

Upvotes: 1

Related Questions