Ready to get started?

Download a free trial of the SharePoint Driver to get started:

 Download Now

Learn more:

SharePoint Icon SharePoint JDBC Driver

Provides 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!

Connect to SharePoint Data from a Connection Pool in Jetty

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

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.

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 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=""> <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

  4. Configure the resource in the Web.xml:

    jdbc/sharepointdb javax.sql.DataSource Container
  5. 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");

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.