Added regression test on SQL comparison to null variable. Stopping the databases in simple apps. Part of #2347.