Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Microsoft Project consists of three basic steps:
- Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
- Provide the driver class. For example:
cdata.jdbc.microsoftproject.MicrosoftProjectDriver
- Provide the JDBC URL. For example:
jdbc:microsoftproject:user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot; or jdbc:cdata:microsoftproject:user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;
The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:microsoftproject:" or "jdbc:cdata:microsoftproject:" and can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to Microsoft Project
In order to connect to the Microsoft Project data source, you will first need to specify the below connection properties.
- Url: (Required) Set this to a valid Microsoft Project Web App URL. For example:
http://contoso.com/sites/pwa/
- Schema: (Optional) There are two available schemas, "ODataV1" and "ODataV2". The "ODataV2" schema (default) can be used for full CRUD operations. However, for reporting purposes, the "ODataV1" schema is superior, since it provides more granular data and exposes the custom fields. See Data Model for more information about the available functionality in each Schema.
- ProjectId: (Optional) If the "ODataV2" schema is specified, you can additionally set this property to a specific Project Id, in order to define the default project for all the operations that require one.
Authenticating to Project Online
There are several authentication methods available for connecting to Microsoft Project including the SharePoint Online Cookie Service to connect on SharePoint Online, OAuth and SSO. The supported SSO identity providers are: Azure Active Directory, OneLogin, and OKTA.
SharePoint Online Cookie Service
To connect to Microsoft Project on SharePoint Online using your login credentials, set the AuthScheme to SharePointOnlineCookies, the User and Password to your user credentials.
OAuth
To use the OAuth 2.0 authentication standard you should first create a custom OAuth app to obtain the OAuthClientId, OAuthClientSecret. In addition to those properties, set CallbackURL. See Using OAuth2 Authentication for more information.
You should set the AuthScheme to OAuth to enforce the OAuth Authentication scheme.
ADFS
Set the AuthScheme to ADFS. The following connection properties need to be set:
- User: Set this to your ADFS username.
- Password: Set this to your ADFS password.
- SSOLoginURL: Set this to the login URL used by the SSO provider.
AuthScheme=ADFS;User=username;Password=password;SSOLoginURL='https://sts.company.com';
ADFS Integrated
To use the ADFS Integrated flow, specify the SSOLoginURL and leave the username and password empty.
Okta
Set the AuthScheme to Okta. The following connection properties are used to authenticate through Okta:
- User: Set to your Okta user.
- Password: Set to your Okta password.
- SSOLoginURL: Set to the login URL used by the SSO provider.
- using a trusted application or proxy that overrides the Okta client request
- configuring MFA
then you need to use combinations of SSOProperties input parameters to authenticate using Okta. Otherwise, you do not need to set any of these values.
In SSOProperties when required, set these input parameters:
- APIToken: When authenticating a user via a trusted application or proxy that overrides the Okta client request context, set this to the API Token the customer created from the Okta organization.
- MFAType: Set this if you have configured the MFA flow. Currently we support the following types: OktaVerify, Email, and SMS.
- MFAPassCode: Set this only if you have configured the MFA flow. If you set this to empty or an invalid value, the driver issues a one-time password challenge to your device or email. After the passcode is received, reopen the connection where the retrieved one-time password value is set to the MFAPassCode connection property.
- MFARememberDevice: Okta supports remembering devices when MFA is required. If remembering devices is allowed according to the configured authentication policies, the driver sends a device token to extend MFA authentication lifetime. This property is, by default, set to True. Set this to False only if you do not want MFA to be remembered.
Example connection string:
AuthScheme=Okta;SSOLoginURL='https://example.okta.com/home/appType/0bg4ivz6cJRZgCz5d6/46';User=oktaUserName;Password=oktaPassword;
OneLogin
Set the AuthScheme to OneLogin. The following connection properties are used to connect to OneLogin:
- User: Set this to the OneLogin user.
- Password: Set this to OneLogin password for the user.
- OAuthClientId: Set to the OAuthClientId, which can be obtained by selecting Developers > API Credentials > Credential > ClientId.
- OAuthClientSecret: Set to the OAuthClientSecret, which can be obtained by selecting Developers > API Credentials > Credential > ClientSecret.
- Subdomain: Set to the subdomain of the OneLogin user accessing the SSO app. For example, if your OneLogin URL is splinkly.onelogin.com, enter splinkly as the subdomain value.
- AppId: Set to the Id of the SSO app.
- Region (optional): Set to the region your OneLogin account resides in. The OneLogin API operates in multiple regions and this property is used to find the correct domain. It can take one of the following values:
- US (default)
- EU
The following is an example connection string:
The following connection string uses an API key to connect to OneLogin:
AuthScheme=OneLogin;User=OneLoginUserName;Password=OneLoginPassword;SSOProperties='OAuthClientID=3fc8394584f153ce3b7924d9cd4f686443a52b;OAuthClientSecret=ca9257fd5cc3277abb5818cea28c06fe9b3b285d73d06;Subdomain=OneLoginSubDomain;AppId=1433920';
AzureAD
Set the AuthScheme to AzureAD. The following connection properties are used to connect to AzureAD:
Note that this configuration requires two AAD applications: the "Microsoft Project" application used for single sign-on, and a separate "connector" application with user_impersonation permission on the "Microsoft Project" application. You must also specify the OAuth connection properties:
- OAuthClientId: The application Id of the connector application, listed in the Overview section of the app registration.
- OAuthClientSecret: The client secret value of the connector application. Azure AD displays this when you create a new client secret.
The following SSOProperties are used to authenticate to AzureAD:
- Resource: The application Id URI of the Microsoft Project application, listed in the Overview section of the app registration. In most cases this is the URL of your custom Microsoft Project domain.
- AzureTenant: The Id of the Azure AD tenant where the applications are registered.
The following is an example connection string:
AuthScheme=AzureAD;InitiateOAuth=GETANDREFRESH;OAuthClientId=3ea1c786-d527-4399-8c3b-2e3696ae4b48;OauthClientSecret=xxx;SSOProperties='Resource=';