• PallavD
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hi All,

 

I have a requirement where in I need to pull some data from a external SQL data base and push it through to SQL object using Apex command line data loader. I have a very little understanding of how the command line data loader works. Could you please provide me with the understanding/ code snippet on how to connect to sql and pull data from it? Also, what all things that needs to go in database config XML file and what all things that needs to go to Process- config XML file.

 

 

You help is much appriciated.

 

Thanks and regards,

 

Pallav

Hi All,

 

I have a question regarding consuming RSS feeds from Apex. I have a requirement where I need to get the data extracted from RSS feeds on Exchange rates and insert them in the Dated Exchange Rate table in salesforce and also to fixed exchange rate table.

 

I am aware that I need to write a Apex DOM class to read the feeds and apply the custom logic of matching out the diffrent currencies and upload in the relevent salesforce object for exchange rates. I am also aware that I need to get a subscription to the RSS feeds.

 

I faces problem in understanding how can I actully get the XML file and how to use or make a call to get the values using Apex class.

 

Please advice. Thanks a lot in advance for your responses.

 

Thanks and regards,

 

Pallav

Hi All,

 

I have a question regarding consuming RSS feeds from Apex. I have a requirement where I need to get the data extracted from RSS feeds on Exchange rates and insert them in the Dated Exchange Rate table in salesforce and also to fixed exchange rate table.

 

I am aware that I need to write a Apex DOM class to read the feeds and apply the custom logic of matching out the diffrent currencies and upload in the relevent salesforce object for exchange rates. I am also aware that I need to get a subscription to the RSS feeds.

 

I faces problem in understanding how can I actully get the XML file and how to use or make a call to get the values using Apex class.

 

Please advice. Thanks a lot in advance for your responses.

 

Thanks and regards,

 

Pallav

 

 
I am using apex data loader 11.0 command line to extract data to CSV file, it's works, I would like to extract data from salesforce directly into MS SQL 2005, I was spent a lot of time to try and search the knowadge in this community but still not able to get this works, below is my code in database-con.xml:
Code:
<!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.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://localhost;databaseName=CRMReport;"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>


<bean id="tmpAccount"
      class="com.salesforce.lexiloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig" ref="queryAccount"/>
    <property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccount"
      class="com.salesforce.lexiloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
 select Id, IsDeleted, MasterRecordId, 
  Name, Type, RecordTypeId, ParentId, 
  BillingStreet, BillingCity, BillingState, 
  BillingPostalCode, BillingCountry, ShippingStreet, 
  ShippingCity, ShippingState, ShippingPostalCode, 
  ShippingCountry, Phone, Fax, 
  Website, Industry, AnnualRevenue, 
  NumberOfEmployees, 
  Description, CurrencyIsoCode, 
  OwnerId, CreatedDate, CreatedById, 
  LastModifiedDate, LastModifiedById, 
  SystemModstamp, LastActivityDate, 
  Region__c, Annual_Procurment__c, 
  Trial_Balance_Code__c, Customer_Group__c, 
  SAP_VEGA_1_Account_Number__c, 
  SAP_VEGA_2_Account_Number__c, 
  QAD_Account_Number__c, 
  BAAN_Account_Number__c, Brief_Name__c,Customer_PBU__c
 from tmpAccount
        </value>
    </property>
</bean>
</beans>


 
and then I have process-conf.xml as well:
 
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <!-- Extract Account to CSV File -->
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 11.0\Delphi\Conf\ExtractAccountMap.sdl"/>
                <entry key="dataAccess.type" value="databaseWrite"/>
                <entry key="dataAccess.name" value="tmpAccount"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, 
                     RecordTypeId, ParentId, BillingStreet, BillingCity, 
                     BillingState, BillingPostalCode, BillingCountry, 
                     ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, 
                     ShippingCountry, Phone, Fax, Website, Industry, AnnualRevenue, 
                     NumberOfEmployees, Description, CurrencyIsoCode, OwnerId, 
                     CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, 
                     SystemModstamp, LastActivityDate, Region__c, Annual_Procurment__c, 
                     Trial_Balance_Code__c, Customer_Group__c, 
                     SAP_VEGA_1_Account_Number__c, SAP_VEGA_2_Account_Number__c, 
                     QAD_Account_Number__c, BAAN_Account_Number__c, Brief_Name__c, 
                     Customer_PBU__c FROM Account"/>
            </map>
        </property>
    </bean>
</beans>

 

I downloaded the Microsoft SQL Server 2005 JDBC 1.2 into my C:\MSJDBC folder, and changed the original proccess.bat file to:
Code:
@echo off
if not [%1]==[] goto run
echo.
echo Usage: process ^<configuration directory^> ^[process name^]
echo.
echo      configuration directory -- directory that contains configuration files,
echo          i.e. config.properties, process-conf.xml, database-conf.xml
echo.
echo      process name -- optional name of a batch process bean in process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir AccountInsert
echo.
echo          If process name is not specified, the parameter values from config.properties
echo          will be used to run the process instead of process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir
echo.

goto end

:run
set PROCESS_OPTION=
if not [%2]==[] set PROCESS_OPTION=process.name=%2

..\_jvm\bin\java.exe -classpath ..\DataLoader.jar;C:\MSJDBC\sqljdbc_1.2\enu\sqljdbc.jar -Dsalesforce.config.dir=%1 

com.salesforce.lexiloader.process.ProcessRunner %PROCESS_OPTION%

:end

 
and then we I execute the extract in command line:
 
process.bat ./conf csvAccountExtractProcess
 
I was get below errors:
 

177924 [csvAccountExtract] DEBUG com.salesforce.lexiloader.client.PartnerClient - Beginning web service operation: query
320410 [csvAccountExtract] ERROR com.salesforce.lexiloader.dao.database.Database Reader  - Database error encountered while writing row#1 through row#215 (execute batch update). Database configuration: tmpAccount.  Sql error: The SELECT statement is not permitted in a batch..com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT statement is not permitted in a batch.
 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at com.salesforce.lexiloader.dao.database.DatabaseWriter.writeRowList(DatabaseWriter.java:180)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.writeExtraction(QueryVisitor.java:205)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.visit(QueryVisitor.java:111)
        at com.salesforce.lexiloader.action.ExtractAction.execute(ExtractAction.java:108)
        at com.salesforce.lexiloader.controller.Controller.executeAction(Controller.java:126)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:136)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
 at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)

320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - Processed 214 of 214 total records. Rate: 24851000 records per hour. Estimated time to complete: 0 minutes and 0 seconds.  There are 0 successes and 214 errors.
320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - The extract has fully completed.  There were 0 successful extracts and 214 errors.

Looks like the SELECT statement have some problems, I am looking the solution here, any leads very be high appericated, Thanks
 


Message Edited by Qingsong on 04-15-2008 06:57 PM

Message Edited by Qingsong on 04-15-2008 07:09 PM

Message Edited by Qingsong on 04-15-2008 07:13 PM