function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sadhasivamsadhasivam 

Dataloader with Databasewrite option.

Hi

i am trying to extract data from salesforce and write to the table directly. i am using MySQL  database with the following jars in classpath.

1. Dataloader.jar ( version 23.0)

2. commons-collections-3.2.1.jar

3. commons-dbcp-1.4.jar

4. mysql-connector-java-5.1.17.jar

 

i am getting spring error  "Failed to convert property value of type [org.apache.commons.collections.map.LinkedMap] to required type [java.util.HashMap] for property 'sqlParam"

 

following are my configurations.

 

1. process-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
        <bean id="memberSummary" class="com.salesforce.dataloader.process.ProcessRunner" singleton="false">
                <description>Daily KPM - MemberSummary</description>
                <property name="name" value="memberSummary"/>
                <property name="configOverrideMap">
                        <map>
                                <entry key="dataAccess.name" value="c:\Shoprunner\root.code\srwebsite\cron\DailyKPMReport\memberSummary.csv"/>
                                <entry key="dataAccess.readUTF8" value="true"/>
                                <entry key="dataAccess.writeBatchSize" value="1" />
                                <entry key="dataAccess.writeUTF8" value="true"/>
                                
                                <!-- <entry key="dataAccess.type" value="csvWrite"/> -->  
                				<entry key="dataAccess.type" value="databaseWrite"/>
                				<entry key="dataAccess.name" value="memberSummary"/>
                
                                <entry key="process.enableExtractSuccessOutput" value="true"/>
                                <entry key="process.enableLastRunOutput" value="true"/>
                                <entry key="process.lastRunOutputDirectory" value="c:\Shoprunner\root.code\srwebsite\cron\DailyKPMReport\log"/>
                                <entry key="process.operation" value="extract"/>
                                <entry key="process.statusOutputDirectory" value="c:\Shoprunner\root.code\srwebsite\cron\DailyKPMReport\log"/>
                                <entry key="process.initialLastRunDate" value="2011-11-21T00:00:00.000-0800"/>
                                <entry key="process.mappingfile" value="c:\Shoprunner\root.code\srwebsite\cron\conf\DailyKPMReport\memberSummary.mdl"/>
                                
                                
                                <entry key="sfdc.extractionRequestSize" value="1" />
                                <entry key="sfdc.bulkApiCheckStatusInterval" value="5000"/>
                                <entry key="sfdc.bulkApiSerialMode" value="50000"/>
                                <entry key="sfdc.debugMessages" value="true"/>
                                <entry key="sfdc.debugMessagesFile"   value="c:\Shoprunner\root.code\srwebsite\cron\DailyKPMReport\log\memberSummarySoapTrace.log"/>
                                <entry key="sfdc.enableRetries" value="true"/>
                                <entry key="sfdc.entity" value="Snapshot_Member_Summary__c"/>
                                <entry key="sfdc.extractionRequestSize" value="200"/>
                                <entry key="sfdc.insertNulls" value="false"/>
                                <entry key="sfdc.loadBatchSize" value="200"/>
                                <entry key="sfdc.minRetrySleepSecs" value="2"/>
                                <entry key="sfdc.noCompression" value="false"/>
                                <entry key="sfdc.timeoutSecs" value="60"/>
                                <entry key="sfdc.useBulkApi" value="true"/>
                                <entry key="sfdc.extractionSOQL">
                                	<value><![CDATA[
                                Select Id, Type_Of_Membership__c, 
                                       Member_Count__c, Snapshot_Date__c
  								  From Snapshot_Member_Summary__c
 								 where Snapshot_Date__c = TODAY
 								 ]]>
                                	</value>
                                </entry>
                                
                      </map>
                </property>
        </bean>

 

2. database-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean id="memberSummary"
      class="com.salesforce.dataloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig"  ref="memberSummaryQuery"/>
    <property name="dataSource" ref="frDataSource"/>
</bean>

<bean id="memberSummaryQuery"
      class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
            INSERT INTO member_summary (
               ID, TYPE_OF_MEMBERSHIP__C, MEMBER_COUNT__C, SNAPSHOT_DATE__C)
            VALUES (@id@::numeric, @Type_Of_Membership@, @Member_Count@::numeric, @SnapShot_Date@ )
        </value>
    </property>
    <property name="sqlParams">
        <map>
            <entry key="id"               value="java.lang.String"/>
            <entry key="Type_Of_Membership" value="java.lang.String"/>
            <entry key="Member_Count"      value="integer"/>
            <entry key="SnapShot_Date"     value="java.sql.Date"/>
        </map>
    </property>
</bean>
<bean id="frDataSource" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://localhost/financerunner" />
		<property name="user" value="xxxxxxxx" />
		<property name="password" value="xxxxxx" />
		<property name="initialPoolSize" value="5"></property>
		<property name="minPoolSize" value="50"></property>
		<property name="maxPoolSize" value="200"></property>
		<property name="checkoutTimeout" value="1000"/>
</bean>

</beans>

 

3. sdl mapping file.

ID=Id
TYPE_OF_MEMBERSHIP__C=Type_Of_Membership
MEMBER_COUNT__C=Member_Count
SNAPSHOT_DATE__C=SnapShot_Date

 4. way i am invoking dataloader.

 

java -cp %DLPATH%;%DB_DRIVER%;%CLASSPATH%;.; -Dsalesforce.config.dir=%DLCONF% com.salesforce.dataloader.process.ProcessRunner process.name=memberSummary

 

Cory CowgillCory Cowgill

If this is just an integration point, why don't you try using Talend Open Studio for Data Integration or some other ETL Tool to extract the data from Salesforce and insert into MySQL Database? I have used Talend to integrate between MySQL and Salesforce and its very easy to use and saves you the headache of building a custom integration.