---
schema_version: "1"
id: b80d40868b714be3d016eb3e223db2da8ab7b457777751cf49b1dfc3c8dc15e9
title: Connect to Salesforce
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi-dev-guide-ext-data/guides/concept/bi-ext-data-connect-to-sf.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-ext-data/guide/bi-ext-data-connect-to-sf.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: dc3ddbc2baa55ca3953d132d4ffba7affd10782a2a4c53755afe3f3f6e89fc60
products:
  - Analytics External Data API Developer Guide
  - analytics
---

# Connect to Salesforce

After preparing your data files, the next step in loading external data into CRM Analytics is to connect to your Salesforce organization by using standard Salesforce APIs.

**note:** The following examples use SOAP API, but you can use any of the Salesforce APIs, such as REST API or Apex. The examples assume that you’re using the Web Services Connector.

To load external data into CRM Analytics, first connect to your Salesforce organization. Use the PartnerConnection object to log in to your organization, as shown in the following example. You need to supply a username, password, and endpoint.

```nolang
ConnectorConfig config = new ConnectorConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthEndpoint(endpoint);

PartnerConnection partnerConnection = new PartnerConnection(config);
```

For more information about the Web Services Connector (WSC), see [Introduction to the Web Services Connector](https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector). For more information about user authentication, see [Security and the API](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_concepts_security.htm) in the _SOAP API Developer Guide_.
