Class.forName("com.amazon.redshift.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:redshift://hostname:port/database", "username", "password");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM table_name");
while(resultSet.next()) {
}