Don't use database specific code like that, it'll only make your code less portable. Instead use the Statement.RETURN_GENERATED_KEYS
option when executing an update.
Here's a start to your searches: sql jdbc getgeneratedkeys returns column "id" not found, column type unknown