JDBC Driver for WooCommerce

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 WooCommerce 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.woocommerce.WooCommerceDriver
  • Provide the JDBC URL. For example:
    jdbc:woocommerce: Url=http://localhost/woocommerce/;ConsumerKey=ck_ec52c76185c088ecaa3145287c8acba55a6f59ad;ConsumerSecret=cs_9fde14bf57126156701a7563fc87575713c355e5;
    
    or
    
    jdbc:cdata:woocommerce: Url=http://localhost/woocommerce/;ConsumerKey=ck_ec52c76185c088ecaa3145287c8acba55a6f59ad;ConsumerSecret=cs_9fde14bf57126156701a7563fc87575713c355e5;

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

Connecting to WooCommerce

In order to connect to WooCommerce, you also must specify the URL of the instance to connect to.

  • Url - Set this to the base URL of the WooCommerce instance to connect to. For Example : Url=http://localhost/woocommerce/;

Authenticate to WooCommerce

WooCommerce supports the following authentication methods: Basic Authentication, one-legged OAuth1.0 Authentication and standard OAuth2.0 Authentication.

Basic

Some plugins and some servers may interfere with the Authorization header, if not configured properly.

For these cases, Basic authentication may be used. In this authentication mode, the user provides the consumer_key and the consumer_secret as user and password respectively.

These credentials are then sent as query parameters with each request.

Specify the following properties:

  • AuthScheme - Set this to Basic.
  • User - Set this to your consumer key
  • Password - Set this to your consumer secret

One-legged OAuth 1.0

Specify the following properties (NOTE: the below credentials are generated from WooCommerce settings page and should not be confused with the credentials generated by using WooCommerce OAuth2.0 plugin):

  • AuthScheme - Set this to OAuthOneLegged.
  • ConsumerKey
  • ConsumerSecret

OAuth 2.0

After having configured the OAuth2 Plugin plugin, you may connect to WooCommerce by providing the following connection proeprties:

  • AuthScheme - Set this to OAuth.
  • OAuthClientId
  • OAuthClientSecret
  • CallbackURL
  • InitiateOAuth - Set this to either GETANDREFRESH or REFRESH

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