Showing posts with label Apex Data Loader. Show all posts
Showing posts with label Apex Data Loader. Show all posts

Thursday, September 8, 2011

Apex Data Loader for Mac, Linux and Unix

Salesforce had the foresight to code the Apex Data Loader (ADL) in Java, which is a cross-platform tool that should work on any computer that has a JRE installed. This implies that the ADL should work on all OS's, not just on Windows.

Force 201 made a great post about running ADL with a GUI, but I just wanted to know how to run the ADL in batch mode from a command line (so that I can script the process).

It turns out to be as easy as the following:
  1. Download and install the Apex Data Loader on a Windows computer.
  2. Copy the files in "%ProgramFiles%\salesforce.com\Apex Data Loader apiVersion" to the desired directory on the target computer or server. Use binary mode for data transfer when applicable.
  3. Setup the batch mode configuration files as you normally would. This generally includes config.properties and process-conf.xml.
  4. Look at "\bin\encrypt.bat" to figure out how to create an encrypted password if you need one.
  5. Look at the last few lines of "\bin\process.bat" in the folder to figure out what syntax to use to run ADL via the command line.

For example, with ADL 22.0 on Linux, I can change to the base directory containing all of the ADL files and run this command:
java -cp DataLoader.jar -Dsalesforce.config.dir=conf com.salesforce.dataloader.process.ProcessRunner process.name=classMeetingExtractProcess

classMeetingExtractProcess is the id of one of my beans defined in process-conf.xml.

Thursday, May 12, 2011

Increasing Speed of Command Line Extract/Export with Apex Data Loader

I had a strange problem when I tried to automate a routine, daily export that I was performing with the Apex Data Loader (version 20.0 and 21.0): Exporting through the GUI only took 5 seconds, but exporting through the command line took anywhere from 30 minutes to 1 hour.

After 4 weeks, Salesforce Premier Support finally delivered a solution to the case I logged: Set the sfdc.debugMessages value to false. I'm very glad that Premier Support was able to find a simple solution to this problem.

Apparently, debug messages were so verbose for every record being exported that operation time increased by a ridiculous factor. Luckily for me, debug messages are not that important for an export.