Here's a patch with a fix and a test case.
Description of the changes:
Use a prepared statement instead of a statement so that the schema name and table name can be parameters. This avoids the trouble with having to quote them as string literals with single quotes. (We still need to quote them as identifiers with double quotes some places, but that was done correctly in the existing code.)
Also remember to close the statement and result set.
Quote the column names in the generated GRANT statement.
Add the missing "ON <schema name>.<table name>" part of the generated GRANT statement.
Created table with special characters in name/columns and granted column privileges. Without the fix, this made the different variants of dblook_test fail because the dblook error log was not empty, and also because the dblook output got some extra statements.
Updated the canons for the dblook_test variants so that they expect the extra output caused by the new database objects added in dblook_makeDB.sql. Some of the canons also got this error text added, because of the bug in the table exclusion logic mentioned in my previous comment:
+FAILED: to execute cmd from DDL script:
+GRANT SELECT("'Single' and ""double"" quoted column name") ON "'Single' and ""double"" quoted schema name"."'Single' and ""double"" quoted table name" TO "SOMEONE"
+Schema ''Single' and "double" quoted schema name' does not exist
I have only run the following tests yet:
derbynet/dblook_test_net.java (client and JCC)
derbynet/dblook_test_net_territory.java (client and JCC)
I'll run the full regression test suite and come back with the results.