Query SAP SuccessFactors Data as a MySQL Database in Node.js

Ready to get started?

Download for a free trial:

Download Now

Learn more:

SAP SuccessFactors ODBC Driver

The SAP SuccessFactors ODBC Driver is a powerful tool that allows you to connect with live data from SAP SuccessFactors, directly from any applications that support ODBC connectivity.

Access SAP SuccessFactors data like you would a database - read, write, and update SAP SuccessFactors Benefits, Compensation, Jobs, etc. through a standard ODBC Driver interface.



Execute MySQL queries against SAP SuccessFactors data from Node.js.

You can use the SQL Gateway from the ODBC Driver for SAP SuccessFactors to query SAP SuccessFactors data through a MySQL interface. Follow the procedure below to start the MySQL remoting service of the SQL Gateway and start querying using Node.js.

Connect to SAP SuccessFactors Data

If you have not already done so, provide values for the required connection properties in the data source name (DSN). You can use the built-in Microsoft ODBC Data Source Administrator to configure the DSN. This is also the last step of the driver installation. See the "Getting Started" chapter in the help documentation for a guide to using the Microsoft ODBC Data Source Administrator to create and configure a DSN.

You can authenticate to SAP Success Factors using Basic authentication or OAuth with SAML assertion.

Basic Authentication

You must provide values for the following properties to successfully authenticate to SAP Success Factors. Note that the provider will reuse the session opened by SAP Success Factors using cookies. Which means that your credentials will be used only on the first request to open the session. After that, cookies returned from SAP Success Factors will be used for authentication.

  • Url: set this to the URL of the server hosting Success Factors. Some of the servers are listed in the SAP support documentation (external link).
  • User: set this to the username of your account.
  • Password: set this to the password of your account.
  • CompanyId: set this to the unique identifier of your company.

OAuth Authentication

You must provide values for the following properties, which will be used to get the access token.

  • Url: set this to the URL of the server hosting Success Factors. Some of the servers are listed in the SAP support documentation (external link).
  • User: set this to the username of your account.
  • CompanyId: set this to the unique identifier of your company.
  • OAuthClientId: set this to the API Key that was generated in API Center.
  • OAuthClientSecret: the X.509 private key used to sign SAML assertion. The private key can be found in the certificate you downloaded in Registering your OAuth Client Application.
  • InitiateOAuth: set this to GETANDREFRESH.

Configure the SQL Gateway

See the SQL Gateway Overview to set up connectivity to SAP SuccessFactors data as a virtual MySQL database. You will configure a MySQL remoting service that listens for MySQL requests from clients. The service can be configured in the SQL Gateway UI.

Query SAP SuccessFactors from Node.js

The following example shows how to define a connection and execute queries to SAP SuccessFactors with the mysql module. You will need the following information:

  • Host name or address, and port: The machine and port where the MySQL remoting service is listening for MySQL connections.
  • Username and password: The username and password of a user you authorized on the Users tab of the SQL Gateway.
  • Database name: The DSN you configured for the MySQL remoting service.

Connect to SAP SuccessFactors data and start executing queries with the code below:

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  database : 'CData SAPSuccessFactors Sys',
  port	   : '3306',
  user     : 'mysql_user',
  password : 'test'
});
connection.connect();
connection.query('SELECT * FROM ExtAddressInfo', function(err, rows, fields) {
  if (err) throw err;
  console.log(rows);
});

connection.end();