JDBC Driver for MYOB

Build 22.0.8462

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 MYOB 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.myob.MYOBDriver
  • Provide the JDBC URL. For example:
    jdbc:myob: If using an online instance: InitiateOAuth=GETANDREFRESH;OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CompanyFileId=yourCompanyFileId;CallbackURL=http://localhost:33333;User=companyFileUser;Password=companyFilePassword; If using an on premise instance: InitiateOAuth=OFF;URL=http://localhost:8080/accountright;CompanyFileId=327eed10-9615-4e5e-bd9e-ae2cc00e2c70;User=companyFileUser;Password=companyFilePassword;
    
    or
    
    jdbc:cdata:myob: If using an online instance: InitiateOAuth=GETANDREFRESH;OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CompanyFileId=yourCompanyFileId;CallbackURL=http://localhost:33333;User=companyFileUser;Password=companyFilePassword; If using an on premise instance: InitiateOAuth=OFF;URL=http://localhost:8080/accountright;CompanyFileId=327eed10-9615-4e5e-bd9e-ae2cc00e2c70;User=companyFileUser;Password=companyFilePassword;

    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:myob:" or "jdbc:cdata:myob:" and can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to MYOB:

See to connect with the driver's embedded credentials and skip creating a custom OAuth app.

These properties are required when connecting to a company file (both for Cloud and On-Premise instances).

  • User: The username associated with your company file.
  • CompanyFileId:The ID of the company file. If not specified, the ID of the first returned company file will be used. You can find this by querying the CompanyFiles view:
    SELECT Id FROM CompanyFiles

Connecting to an On-Premise instance:

InitiateOAuth: Set this to OFF

When connecting to an on-premise instance, you will need to set the following connection property in addition to those above:

  • Url: The Url of your MYOB instance.
  • Password: The password associated with your company file.

Connecting to a Cloud Instance

Establish a connection to MYOB without setting any additional connection properties using the driver's Embedded Credentials.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462