The isam error tells you the exact cause of the
problem ("the file is locked...").
Are you running this program concurrently or is another
program trying to change (insert, update, delete or select)
the same rows ?
You should create your table with row-level-locking
not page-level-locking, i.e.:
create table tablename(col1 as char(10)) lock mode row;
And perform the statement 'set lock mode to wait 5' in your
jdbc program.
This should help to avoit the problem.
Be careful with mode-ansi-databases. You have automatically
the default isolation level of 'repeatable read'. This is in
most cases not what you want. So you should either change
the isolation level to committed read or cursor stability or
you should normal 'unbuffered' databases, but not mode-ansi (create database <db> with log).