![]() |
VOOZH | about |
The CData JDBC driver for SAP Ariba Source is easy to integrate with Java Web applications. This article shows how to efficiently connect to SAP Ariba Source data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for SAP Ariba Source in Jetty.
Follow the steps below to connect to Salesforce from Jetty.
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
Declare the resource and its scope. Enter the required connection properties in the resource declaration. This example declares the SAP Ariba Source data source at the level of the Web app, in WEB-INF\jetty-env.xml.
<Configure id='saparibasourcedemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="saparibasourcedemo" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg><Ref refid="saparibasourcedemo"/></Arg> <Arg>jdbc/saparibasourcedb</Arg> <Arg> <New class="cdata.jdbc.saparibasource.SAPAribaSourceDriver"> <Set name="url">jdbc:saparibasource:</Set> <Set name="API">SupplierDataAPIWithPagination-V4</Set> <Set name="APIKey">wWVLn7WTAXrIRMAzZ6VnuEj7Ekot5jnU</Set> <Set name="Environment">SANDBOX</Set> <Set name="Realm">testRealm</Set> <Set name="AuthScheme">OAuthClient</Set> <Set name="InitiateOAuth">GETANDREFRESH</Set> </New> </Arg> </New> </Configure>
In order to connect with SAP Ariba Source, set the following:
If you are connecting to the Supplier Data API or the Contract API, additionally set the following:
If you're connecting to the Supplier API, set ProjectId to the Id of the sourcing project you want to retrieve data from.
After setting connection properties, you need to configure OAuth connectivity to authenticate.
For more information on creating an OAuth application, refer to the Help documentation.
After setting the following, you are ready to connect:
When you connect, the provider automatically completes the OAuth process:
Configure the resource in the Web.xml:
jdbc/saparibasourcedb javax.sql.DataSource Container
You can then access SAP Ariba Source with a lookup to java:comp/env/jdbc/saparibasourcedb:
InitialContext ctx = new InitialContext();
DataSource mysaparibasource = (DataSource)ctx.lookup("java:comp/env/jdbc/saparibasourcedb");
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.
Download a free trial of the SAP Ariba Source Driver to get started:
Download NowLearn more:
👁 SAP Ariba Source IconRapidly create and deploy powerful Java applications that integrate with SAP Ariba Source.