![]() |
VOOZH | about |
The CData JDBC driver for SharePoint is easy to integrate with Java Web applications. This article shows how to efficiently connect to SharePoint data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for SharePoint in Jetty.
Accessing and integrating live data from SharePoint has never been easier with CData. Customers rely on CData connectivity to:
Most customers rely on CData solutions to integrate SharePoint data into their database or data warehouse, while others integrate their SharePoint data with preferred data tools, like Power BI, Tableau, or Excel.
For more information on how customers are solving problems with CData's SharePoint solutions, refer to our blog: Drivers in Focus: Collaboration Tools.
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 SharePoint data source at the level of the Web app, in WEB-INF\jetty-env.xml.
<Configure id='sharepointdemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="sharepointdemo" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg><Ref refid="sharepointdemo"/></Arg> <Arg>jdbc/sharepointdb</Arg> <Arg> <New class="cdata.jdbc.sharepoint.SharePointDriver"> <Set name="url">jdbc:sharepoint:</Set> <Set name="User">myuseraccount</Set> <Set name="Password">mypassword</Set> <Set name="Auth Scheme">NTLM</Set> <Set name="URL">http://sharepointserver/mysite</Set> <Set name="SharePointEdition">SharePointOnPremise</Set> </New> </Arg> </New> </Configure>
Set the URL property to the base SharePoint site or to a sub-site. This allows you to query any lists and other SharePoint entities defined for the site or sub-site.
The User and Password properties, under the Authentication section, must be set to valid SharePoint user credentials when using SharePoint On-Premise.
If you are connecting to SharePoint Online, set the SharePointEdition to SHAREPOINTONLINE along with the User and Password connection string properties. For more details on connecting to SharePoint Online, see the "Getting Started" chapter of the help documentation
Configure the resource in the Web.xml:
jdbc/sharepointdb javax.sql.DataSource Container
You can then access SharePoint with a lookup to java:comp/env/jdbc/sharepointdb:
InitialContext ctx = new InitialContext();
DataSource mysharepoint = (DataSource)ctx.lookup("java:comp/env/jdbc/sharepointdb");
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 SharePoint Driver to get started:
Download NowLearn more:
👁 SharePoint IconProvides Java developers with the power to easily connect their Web, Desktop, and Mobile applications to data in SharePoint Server Lists, Contacts, Calendar, Links, Tasks, and more!