You need to sign in to do that
Don't have an account?
Format of csv provided by salesforce when using bulk api
I am using the salesforce bulk api to extract data. I have some issue with the format that salesforce provide me the data using Bulk api. Below is the short code i used which ran successfully and creates a csv for me :
InputStream inputStream = bulkConnection.getQueryResultStream(job.getId(), batchInfo.getId(), resultId); OutputStream out = new FileOutputStream(file); try { int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } inputStream.close(); out.flush(); logger.log(logger.DEBUG,"New file created!"); } catch (IOException e) { logger.log(logger.DEBUG,"ErrorMsg in wrtting csv file"+e.getMessage()); throw new RuntimeException("ErrorMsg in wrtting csv file"+e.getMessage()); }
All I have done is wrote the bytes provided by salesforce into a csv file, i have not changed/modified anything. Now the issue is, in this csv all the Logical records are terminated by LF(Line feed) and the physical records are terminated by CRLF(carriage return + Line feed). attached is the snapshot
Now if I download the same objects records by using Data Loader, the downloaded csv is of different format. In this csv all logical records are terminated by CRLF and physical by LF, opposite of bulk api csv.
All I want to known is if there is any way I can download the records in the format that Data Loader provide, by using the bulk api.
Any suggestion would be heartily appreciated. Thanks