Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoginFault #1

Open
ravikumargadagotti opened this issue Jul 30, 2018 · 2 comments
Open

LoginFault #1

ravikumargadagotti opened this issue Jul 30, 2018 · 2 comments

Comments

@ravikumargadagotti
Copy link

public class SalesforceTest {

	public static void main(String[] args)  {
		try {
		Connection con = null;
		
		Class.forName("com.ascendix.jdbc.salesforce.ForceDriver");
		con = DriverManager.getConnection(
				"jdbc:ascendix:salesforce://[loginDomain=https://login.salesforce.com/services/oauth2/authorize;DatabaseName=SFORCE;[email protected];password=somepassword]");
		Statement pstmt = con.createStatement();
		
		ResultSet rs = pstmt.executeQuery("SELECT COUNT(*) FROM SFORCE.ACCOUNT");
		while (rs.next()) {
			System.out.println(rs.getString(1));
		}
		}catch(ClassNotFoundException cfe) {
			cfe.printStackTrace();
		}catch(SQLException se) {
			se.printStackTrace();
		}catch(Exception e) {
			e.printStackTrace();
		}
	}
}

I am using above class and the saleforce jdbc jar which is downloaded from here but I am getting the following error

java.sql.SQLException: [LoginFault [ApiFault  exceptionCode='INVALID_LOGIN'
 exceptionMessage='Invalid username, password, security token; or user locked out.'
 extendedErrorDetails='{[0]}'
]
]

	at com.ascendix.jdbc.salesforce.ForceDriver.connect(ForceDriver.java:53)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:270)
	at SalesforceTest.main(SalesforceTest.java:14)
Caused by: [LoginFault [ApiFault  exceptionCode='INVALID_LOGIN'
 exceptionMessage='Invalid username, password, security token; or user locked out.'
 extendedErrorDetails='{[0]}'
]
]

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at java.lang.Class.newInstance(Class.java:442)
	at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:673)
	at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:556)
	at com.sforce.ws.transport.SoapConnection.parseDetail(SoapConnection.java:236)
	at com.sforce.ws.transport.SoapConnection.createException(SoapConnection.java:210)
	at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:156)
	at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
	at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.java:818)
	at com.sforce.soap.partner.PartnerConnection.<init>(PartnerConnection.java:427)
	at com.sforce.soap.partner.Connector.newConnection(Connector.java:28)
	at com.ascendix.jdbc.salesforce.ForceConnection.getConnectionByUserCredential(ForceConnection.java:93)
	at com.ascendix.jdbc.salesforce.ForceConnection.getPartnerConnection(ForceConnection.java:51)
	at com.ascendix.jdbc.salesforce.ForceDatabaseMetaData.<init>(ForceDatabaseMetaData.java:28)
	at com.ascendix.jdbc.salesforce.ForceConnection.<init>(ForceConnection.java:38)
	at com.ascendix.jdbc.salesforce.ForceDriver.connect(ForceDriver.java:51)
	... 3 more

Any help would be greatly appreciates, and the same username is working when I am going through the login.salesforce.com.

@eryabitskiy-acx
Copy link
Contributor

eryabitskiy-acx commented Sep 4, 2018

Hi,
Sorry for late answer.

Did you use just SF password or password + secret key ?

And secret key is a key from you Connected Apps:
Connected App using OAuth needs Client ID and Client Secret to Authenticate
https://help.salesforce.com/articleView?id=000205876&language=en_US&type=1

I can agree it is not clear from properties that password is not just a password but password + key. Mb we will change that.

@ravikumargadagotti
Copy link
Author

I am just using the password, from where can I obtain the secret key?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants