![]() |
VOOZH | about |
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.
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 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.
Set AuthScheme to "Basic" or "Digest" and set User and Password. Specify other authentication values in CustomHeaders.
Set the Windows User and Password and set AuthScheme to "NTLM".
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.
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.
Configure the resource in the Web.xml:
jdbc/ssasdb javax.sql.DataSource Container
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");
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 SQL Analysis Services Driver to get started:
Download NowLearn more:
👁 SQL Server Analysis Services IconRapidly create and deploy powerful Java applications that integrate with SQL Analysis Services.