From http://www.java2s.com/Code/Java/Database-SQL-JDBC/JDBCselect.htm