Do note that using SQL variables is SQL scripting, which isn't actually in the JDBC spec. Some drivers allow it, but you really shouldn't be doing that if you want your work to be portable.
Single statements for JDBC. Scripts belong in stored procedures.