I'll link to the postgres JDBC doc that explains what I am doing.