Ready to get started?

Download a free trial of the Adobe Commerce Driver to get started:

 Download Now

Learn more:

Adobe Commerce Icon Adobe Commerce JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Adobe Commerce including Customers, Inventory, Products, Orders, and more!

Connect to Adobe Commerce Data from a Connection Pool in Jetty

The Adobe Commerce JDBC Driver supports connection pooling: This article shows how to connect faster to Adobe Commerce data from Web apps in Jetty.

The CData JDBC driver for Adobe Commerce is easy to integrate with Java Web applications. This article shows how to efficiently connect to Adobe Commerce data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for Adobe Commerce in Jetty.

Configure the JDBC Driver for Salesforce as a JNDI Data Source

Follow the steps below to connect to Salesforce from Jetty.

  1. Enable the JNDI module for your Jetty base. The following command enables JNDI from the command-line:

    java -jar ../start.jar --add-to-startd=jndi
  2. Add the CData and license file, located in the lib subfolder of the installation directory, into the lib subfolder of the context path.
  3. Declare the resource and its scope. Enter the required connection properties in the resource declaration. This example declares the Adobe Commerce data source at the level of the Web app, in WEB-INF\jetty-env.xml.

    <Configure id='adobecommercedemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="adobecommercedemo" class=""> <Arg><Ref refid="adobecommercedemo"/></Arg> <Arg>jdbc/adobecommercedb</Arg> <Arg> <New class="cdata.jdbc.adobe commerce.Adobe CommerceDriver"> <Set name="url">jdbc:adobe commerce:</Set> <Set name="OAuthClientId">MyConsumerKey</Set> <Set name="OAuthClientSecret">MyConsumerSecret</Set> <Set name="CallbackURL"></Set> <Set name="Url">https://myAdobe</Set> <Set name="InitiateOAuth">GETANDREFRESH</Set> </New> </Arg> </New> </Configure>

    Adobe Commerce uses the OAuth 1 authentication standard. To connect to the Adobe Commerce REST API, you will need to obtain values for the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties by registering an app with your Adobe Commerce system. See the "Getting Started" section in the help documentation for a guide to obtaining the OAuth values and connecting.

    You will also need to provide the URL to your Adobe Commerce system. The URL depends on whether you are using the Adobe Commerce REST API as a customer or administrator.

    • Customer: To use Adobe Commerce as a customer, make sure you have created a customer account in the Adobe Commerce homepage. To do so, click Account -> Register. You can then set the URL connection property to the endpoint of your Adobe Commerce system.

    • Administrator: To access Adobe Commerce as an administrator, set CustomAdminPath instead. This value can be obtained in the Advanced settings in the Admin menu, which can be accessed by selecting System -> Configuration -> Advanced -> Admin -> Admin Base URL.

      If the Use Custom Admin Path setting on this page is set to YES, the value is inside the Custom Admin Path text box; otherwise, set the CustomAdminPath connection property to the default value, which is "admin".

  4. Configure the resource in the Web.xml:

    jdbc/adobecommercedb javax.sql.DataSource Container
  5. You can then access Adobe Commerce with a lookup to java:comp/env/jdbc/adobecommercedb: InitialContext ctx = new InitialContext(); DataSource myadobecommerce = (DataSource)ctx.lookup("java:comp/env/jdbc/adobecommercedb");

More Jetty Integration

The steps above show how to configure the driver in a simple connection pooling scenario. For more use cases and information, see the Working with Jetty JNDI chapter in the Jetty documentation.