The error is basically in the way you are approaching the database.
The data manipulation language part of SQL deals primarily with /sets/
of rows, not with individual rows. The UPDATE command is used to
change the content of a set of rows. If there is no WHERE clause on
the UPDATE command, the UPDATE happily updates all the rows of the
table. If there happen to be no rows in the database, the UPDATE
command happily updates all zero rows in the table.
You are, as I understand it, trying to do a conditional insertion: if
the row is not already there, then insert it. The way to do this is
to (i) check if the row is already there and (ii) if not, insert it.
You can check if the row is already there in several ways; one way is
to UPDATE the /set of rows/ comprising that particular row (like,
WHERE ID = '3') and check if the update affected a non-zero count of
rows. (Another, more polite, way is to SELECT the set of rows
comprising that particular row and check if the recordset returned has
any records. Don't forget to close the recordset afterwards.) So
there will be a conditional in your Java checking what the database
SQL returns. If the row is not there, you want to do an INSERT into
the appropriate table to put the row there.
There are two tricks to thinking about databases: (i) the database is
not a file, it is a data co-processor spiritually akin to, say, a
floating point co-processor; and (ii) that data co-processor deals in
sets of rows.