A safer way to code SQL queries in Java

This is not to say that the suggested code in this blog will block SQL injection attacks. What we have below is a generally accepted safer way to code SQL queries in Java.