Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Configure the CData JDBC Driver for WooCommerce in a Connection Pool in Tomcat
Connect to WooCommerce data from a connection pool in Tomcat.
The CData JDBC Drivers support standard JDBC interfaces to integrate with Web applications running on the JVM. This article details how to connect to WooCommerce data from a connection pool in Tomcat.
Connect to WooCommerce Data through a Connection Pool in Tomcat
- Copy the CData JAR and CData .lic file to $CATALINA_HOME/lib. The CData JAR is located in the lib subfolder of the installation directory.
- Add a definition of the resource to the context. Specify the JDBC URL here.
WooCommerce supports the following authentication methods: one-legged OAuth1.0 Authentication and standard OAuth2.0 Authentication.
Connecting using one-legged OAuth 1.0 Authentication
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 WordPress OAuth2.0 plugin):
- ConsumerKey
- ConsumerSecret
Connecting using WordPress OAuth 2.0 Authentication
- Add a reference to the resource to the web.xml for the application.
WooCommerce data JSP jdbc/WooCommerce javax.sql.DataSource Container -
Initialize connections from the connection pool:
Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/WooCommerce"); Connection conn = ds.getConnection();
More Tomcat Integration
The steps above show how to connect to WooCommerce data in a simple connection pooling scenario. For more use cases and information, see the JNDI Datasource How-To in the Tomcat documentation.