Ready to get started?

Learn more about the CData JDBC Driver for SQL Analysis Services or download a free trial:

Download Now

Connect to SQL Analysis Services Data from a Connection Pool in Jetty

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

The CData JDBC driver for SQL Analysis Services is easy to integrate with Java Web applications. This article shows how to efficiently connect to SQL Analysis Services data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for SQL Analysis Services 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 SQL Analysis Services data source at the level of the Web app, in WEB-INF\jetty-env.xml.

    <Configure id='ssasdemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="ssasdemo" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg><Ref refid="ssasdemo"/></Arg> <Arg>jdbc/ssasdb</Arg> <Arg> <New class="cdata.jdbc.ssas.SSASDriver"> <Set name="url">jdbc:ssas:</Set> <Set name="User">myuseraccount</Set> <Set name="Password">mypassword</Set> <Set name="URL">http://localhost/OLAP/msmdpump.dll</Set> </New> </Arg> </New> </Configure>

    To connect, provide authentication and set the Url property to a valid SQL Server Analysis Services endpoint. You can connect to SQL Server Analysis Services instances hosted over HTTP with XMLA access. See the Microsoft documentation to configure HTTP access to SQL Server Analysis Services.

    To secure connections and authenticate, set the corresponding connection properties, below. The data provider supports the major authentication schemes, including HTTP and Windows, as well as SSL/TLS.

    • HTTP Authentication

      Set AuthScheme to "Basic" or "Digest" and set User and Password. Specify other authentication values in CustomHeaders.

    • Windows (NTLM)

      Set the Windows User and Password and set AuthScheme to "NTLM".

    • Kerberos and Kerberos Delegation

      To authenticate with Kerberos, set AuthScheme to NEGOTIATE. To use Kerberos delegation, set AuthScheme to KERBEROSDELEGATION. If needed, provide the User, Password, and KerberosSPN. By default, the data provider attempts to communicate with the SPN at the specified Url.

    • SSL/TLS:

      By default, the data provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats.

    You can then access any cube as a relational table: When you connect the data provider retrieves SSAS metadata and dynamically updates the table schemas. Instead of retrieving metadata every connection, you can set the CacheLocation property to automatically cache to a simple file-based store.

    See the Getting Started section of the CData documentation, under Retrieving Analysis Services Data, to execute SQL-92 queries to the cubes.

  4. Configure the resource in the Web.xml:

    jdbc/ssasdb javax.sql.DataSource Container
  5. You can then access SQL Analysis Services with a lookup to java:comp/env/jdbc/ssasdb: InitialContext ctx = new InitialContext(); DataSource myssas = (DataSource)ctx.lookup("java:comp/env/jdbc/ssasdb");

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.