user22218991
user22218991

Reputation: 1

spark jdbc salesforce connection: invalid username, password, security token; or user locked out

i am getting jdbc error when connecting from spark to salesforce from windows... using the cdata jdbc driver

i am sure i can login to salesforce with username/password. in addition, reset my password which generate a new security token. have no idea how i can get above error...

details below:

spark-shell --jars "c:\cdata\cdata.jdbc.salesforce.jar"
val = spark.sqlContext
    .read
    .format("jdbc")
    .option("url","jdbc:salesforce:User=myusername;Password=mypassword;SecurityToken=*****;")
    .option("driver","cdata.jdbc.salesforce.SalesforceDriver")
    .load()

i have retried resetting password and regenerating security token(in that order) few times. still getting that error. i am sure my username password is correct because i can login.

Upvotes: 0

Views: 316

Answers (1)

Anil
Anil

Reputation: 24

There are a couple of things that come to mind with regards to this error.

Verify that the Salesforce user account you're using has the "API Enabled" permission. This is required to connect through the JDBC driver.

If your IP address is not included in Salesforce's trusted IP ranges, the connection will fail unless you append the security token to the password. Make sure your current IP address is allowed under Setup > Security Controls > Network Access in Salesforce.

You might also need to modify you jdbc url to include AuthScheme:

jdbc:cdata:salesforce:AuthScheme=Basic;User=myUser;Password=myPassword;Security Token=myToken;

In case the error still persists you can add logging properties to your connection string by modifying it to:

jdbc:cdata:salesforce:AuthScheme=Basic;User=myUser;Password=myPassword;Security Token=myToken;Logfile=D:\\path\\to\\logfile.log;LogVerbosity=3;

Once the Logs are generated please navigate to the error message to get more detailed information on this.

Upvotes: 0

Related Questions