In general, JDBC doesn't support SQL scripts, just single SQL statements. If you want SQL that is widely compatible, don't use DECLARE, or BEGIN/END blocks, et cetera.
Some JDBC drivers support scripts, and others do not. Don't use them, and don't assume something that works in a workbench will work in Ignition.