changing data formatting from sql based to java/csv based