Q:

Get number of rows updated with PreparedStatement

How to get how many rows updated with PreparedStatement?
.getUpdateCount() returns 0.
For executeUpdate got error:
error occurred during batching: batch must be either executed or cleared
my code:
updTrans = dataSource.getConnection().prepareStatement("update...");
updTrans.setInt(1, Integer.valueOf(transaksjonstatusid));
...
updTrans.addBatch();
upd = updTrans.executeUpdate();

A:

You should be using PreparedStatement#executeBatch() when using batches.
...
updTrans.addBatch();
upd = updTrans.executeBatch();

It returns an int[] containing update counts of each batch.

A:

Did you try to use:
int n = preparedStatement.executeUpdate();

Here you can find some explanations on how to use a PreparedStatement.

A:

See The Javadoc

public int executeUpdate()
                    throws SQLException
Executes the SQL statement in this PreparedStatement object, which must
  be an SQL INSERT, UPDATE or DELETE
  statement; or an SQL statement that
  returns nothing, such as a DDL
  statement.
Returns:
  either (1) the row count for INSERT, UPDATE, or DELETE statements
  or (2) 0 for SQL statements that return nothing 
Throws:
          SQLException - if a database access error occurs or the SQL
  statement returns a ResultSet object

