You need to sign in to do that
Don't have an account?

Data is not getting inserted from MySQL databse to Salesforce using DataLoader CLI
Hi,
I am trying to upsert the records from MySQL to Salesforce.com using Data Loader command Line Interpreter(CLI). There are 3 records in MySql table and during upsert 3 empty records are getting inserted in Salesforce Object but custom fields content is not getting inserted. Using .csvfile I am able to do that.
Please find process-conf and database-conf files below :
Process-Conf file:
<bean id="SFAProcess"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>AccountMaster job gets the Customer record updates from ERP (Oracle financials) and uploads them to salesforce using 'upsert'.</description>
<property name="name" value="SFAProcess"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.debugMessages" value="true"/>
<entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
<entry key="sfdc.endpoint" value="https://www.salesforce.com"/>
<entry key="sfdc.username" value="sam@co.com.beta"/>
<entry key="sfdc.password" value="cf644d195b9f45cddf7054e686c35921c0497a0e96867fe689"/>
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.externalIdField" value="SF_Id__c"/>
<entry key="sfdc.entity" value="SFA_Test__c"/>
<entry key="process.operation" value="upsert"/>
<entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 17.0\conf\accountMasterMap.sdl"/>
<entry key="dataAccess.name" value="C:\Program Files\salesforce.com\Apex Data Loader 17.0\extract.csv"/>
<entry key="dataAccess.type" value="csvRead"/>
</map>
</property>
</bean>
database-conf file:
<bean id="dbDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://10.195.70.101:3306/SFA_Test"/>
<property name="username" value="SFA"/>
<property name="password" value="SFA"/>
</bean>
<bean id="querySFATestAll"
class="com.salesforce.dataloader.dao.database.DatabaseConfig"
singleton="true">
<property name="sqlConfig" ref="querySFA_testAllSql"/>
<property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="querySFA_testAllSql"
class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
<property name="sqlString">
<value>
SELECT NAME, NUMBER, ID FROM SFA_Test.SFA_TEST
</value>
</property>
<property name="columnNames">
<list>
<value>Name</value>
<value>Number</value>
<value>ID</value>
</list>
</property>
</bean>
Mapping file:
#Mapping values
#Fri Mar 05 10:04:53 EST 2010
OWNERID=
CREATEDDATE=
ISDELETED=
SNAME__C=SName__c
LASTMODIFIEDBYID=
ID=Id
SF_ID__C=SF_Id__c
CREATEDBYID=
SYSTEMMODSTAMP=
NUMBER__C=Number__c
LASTMODIFIEDDATE=
NAME=
In the log file Success.csv it says success by giving the salesforce Id for the records in MySQL.
Please someone help me... Thanks in advance.
You have "CsvRead". Should it not be something else?
I have mentioned it as databaseRead as below but still same problem
<bean id="SFAProcess"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>AccountMaster job gets the Customer record updates from ERP (Oracle financials) and uploads them to salesforce using 'upsert'.</description>
<property name="name" value="SFAProcess"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.debugMessages" value="true"/>
<entry key="sfdc.debugMessagesFile" value="D:\Program Files\salesforce.com\Apex Data Loader 18.0\test\logs\accountMasterSoapTrace.log"/>
<entry key="sfdc.username" value="santosh@comcast.com.beta"/>
<entry key="sfdc.password" value="cf644d195b9f45cddf7054e686c35921c0497a0e96867fe6892b16209e31b1654fdf512390b62a2f"/>
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.entity" value="SFA_Test__c"/>
<entry key="process.operation" value="insert"/>
<entry key="process.mappingFile" value="D:\Program Files\salesforce.com\Apex Data Loader 18.0\conf\accountMasterMap.sdl"/>
<entry key="dataAccess.name" value="querySFATestAll"/>
<entry key="dataAccess.type" value="databaseRead"/>
<entry key="process.outputSuccess" value="D:\Program Files\salesforce.com\Apex Data Loader 18.0\test\logs\csvUpsertProcess_success.csv" />
<entry key="process.outputError" value="D:\Program Files\salesforce.com\Apex Data Loader 18.0\test\logs\csvUpsertProcess_error.csv" />
</map>
</property>
</bean>
I think, you should have following entries in Process_Conf file.
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.extractionSOQL" value="SELECT NAME, NUMBER, ID FROM SFA_Test.SFA_TEST"/>
<entry key="process.operation" value="extract"/>
<entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 17.0\conf\accountMasterMap.sdl"/>
<entry key="dataAccess.type" value="databaseWrite"/>
<entry key="dataAccess.name" value="updateSFATest"/>
And database-Conf file should be configured as
<bean id="updateSFATest"
class="com.salesforce.dataloader.dao.database.DatabaseConfig"
singleton="true">
<property name="sqlConfig" ref="updateSFATestSql"/>
<property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="updateSFATestSql"
class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
<property name="sqlString">
<value>
update SFA_TEST.SFA_TEST sfa
set sfa.name = @name@,
sfa.number = @number@
where
sfa.ID = @id@
</value>
</property>
<property name="sqlParams">
<map>
<entry key="name" value="java.lang.String"/>
<entry key="numbar" value="java.lang.Double"/>
<entry key="id" value="java.lang.String"/>
</map>
</property>
</bean>
Also refer online documentation / sample configuration fiel available with Apex Data Loader installation folder "C:\Program Files\salesforce.com\Apex Data Loader 18.0\samples"
Regards
Hari Sharma
It looks like you have a typo in your mapping file:
SNAME__C=SName__c
You're reading the "Name" field, but trying to map from "SNAME__C".
Anyway, this is a really old post - did you figure it out?
I'm getting an error on inserts using a similar setup - databaseRead from a MySQL database/query - the dataloader seems to be reading entire rows in and not parsing out the fields. Very strange, and not sure how to resolve. Guess I'll start a thread about it...
Ben
Hi hkvats,
Actually my requirement is inserting the MySQL table data in to sales force object through command line data loader. when i am running the command line data loader, I am getting the error as Caused by:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou rce.java:760)
My database conf file
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dbDataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306;databaseName=test"/>
<property name="username" value="root"/>
<property name="password" value="dskvap"/>
</bean>
<bean id="queryAccountAll"
class="com.salesforce.dataloader.dao.database.DatabaseConfig"
singleton="true">
<property name="sqlConfig" ref="queryAccountAllSql"/>
<property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccountAllSql"
class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
<property name="sqlString">
<value>
SELECT empno,empname,desig from emp
</value>
</property>
<property name="columnNames">
<list>
<value>empno</value>
<value>empname</value>
<value>desig</value>
</list>
</property>
</bean>
</beans>
My process-conf file
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="emp"
class="com.salesforce.dataloader.process.ProcessRunner"
singleton="false">
<description>Opportunity Upsert job gets the Customer record updates from a CSV file and uploads them to salesforce using 'upsert'.</description>
<property name="name" value="emp"/>
<property name="configOverrideMap">
<map>
<entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
<entry key="sfdc.username" value="nagalakshmi_b@dskvap.com"/>
<!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
<entry key="sfdc.password" value="707a2729eb4a1d23be7ba72c0903d34b7c8f21aa1f66324305abcad2e633e423c1abe14d89795588"/>
<entry key="process.encryptionKeyFile" value="C:\Program Files\salesforce.com\Apex Data Loader 23.0\samples\conf\sample.key"/>
<entry key="sfdc.timeoutSecs" value="600"/>
<entry key="sfdc.loadBatchSize" value="200"/>
<entry key="sfdc.externalIdField" value="Oracle_Id__c"/>
<entry key="sfdc.entity" value="emp__c"/>
<entry key="process.operation" value="insert"/>
<entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 23.0\samples\conf\emp.sdl"/>
<entry key="dataAccess.name" value="queryAccountAll"/>
<entry key="dataAccess.type" value="databaseRead"/>
<entry key="process.initialLastRunDate" value="2006-12-01T00:00:00.000-0800"/>
</map>
</property>
</bean>
</beans>
I tried a lot but not getting. Please help me. its very urgent for me. Thanks in advance.
Thanks,
Lakshmi.
Hi
I am getting
My database-conf.xml looks like
In my classpath :
set DB_DRIVER=%DLCONF%\commons-dbcp-1.4,jar;%DLCONF%\mysql-connector-java-5.1.17.jar;%DLCONF%\commons-collections-3.2.1.jar;
its not inserting to my mysql database.