Client Application Developer's Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using SQL to Access Data Services

Applications can access data services through SQL. This is necessary in the case of many reporting tools such as Crystal Reports, Hyperion, and Business Objects. But the ability to handle SQL is also useful in other contexts.

For example, it is useful to be able to run ad hoc SQL queries against data services using tools such as DbVisualizer. Application developers also can use a standalone Query Plan Viewer utility which supports both XQuery and SQL.

BEA AquaLogic Data Services Platform supports table parameters, an extension to SQL-92.

SQL access is provided through the AquaLogic Data Services Platform JDBC driver. The driver implements the java.sql.* interface in JDK 1.4x to provide access to an AquaLogic Data Services Platform server through the JDBC interface. You can use the JDBC driver to execute SQL92 SELECT queries, or stored procedures over AquaLogic Data Services Platform applications.

This chapter explains how to use SQL to access data services as well as how to set up and use the AquaLogic Data Services Platform JDBC driver. It covers the following topics:

Note: For data source and configuration pool information, refer to the WebLogic Administration Guide:
Note: http://download.oracle.com/docs/cd/E13196_01/platform/docs81/admin/index.html

 


Publishing Data Service Functions As SQL

To access data services through SQL, data service functions first need to be published as SQL objects through a JDBC interface. These SQL objects include tables, stored procedures, and functions.

Note: SQL objects published through AquaLogic Data Services Platform need to be enclosed in double quotes when used in an SQL query, if the object name contains a hyphen.

To publish data service functions as SQL Objects, the following tasks need to be performed:

  1. Publish data service functions to a special schema that models them as SQL objects.
  2. Build and deploy your AquaLogic Data Services Platform application.

Once deployed, the newly created SQL objects are available to your application through standard JDBC.

Techniques for publishing data services as SQL are described in Publishing Data Services Functions for SQL Use in the Data Services Developer's Guide.

Note: For details on accessing the AquaLogic Data Services Platform JDBC driver, and information on the relationship between data services artifacts and JDBC, see About the AquaLogic Data Services Platform JDBC Driver.

Using Custom Database Functions through AquaLogic Data Services Platform

Built-in or custom functions in your database can be made available through data services once the function has been registered with AquaLogic Data Services Platform through a library. For more information about using database functions with AquaLogic Data Services Platform, refer to Creating and Working with XQuery Function Libraries in Data Services Developer's Guide.

 


SQL Support in AquaLogic Data Services Platform

This section outlines the SQL-92 support in the AquaLogic Data Services Platform JDBC driver.

Supported Features

The AquaLogic Data Services Platform JDBC driver provides SQL-92 support for the SELECT statement. INSERT, UPDATE, and DELETE statements are not supported. DDL (Data Definition Language) statements are also not supported.

The AquaLogic Data Services Platform JDBC driver implements the following interfaces from java.sql package specified in JDK 1.4x:

Additional Details

The following limitations are known to exist in the AquaLogic Data Services Platform JDBC driver:

The following table (Table 5-1) notes additional limitations that apply to SQL language features.

Table 5-1 Additional AquaLogic Data Services Platform JDBC Limitations Applying to SQL Language Features
Unsupported Feature
Comments
Example
Assignment in select
Not supported.
SELECT MYCOL = 2
FROM VTABLE
WHERE COL4 IS NULL
The CORRESPONDING BY construct with the set-Operations
(UNION, INTERSECT and EXCEPT)
The SQL-92 specified default column ordering in the set operations is supported.
Both the table-expressions (the operands of the set-operator) must conform to the same relational schema.
(SELECT NAME, CITY FROM CUSTOMER1) UNION CORRESPONDING BY (CITY, NAME) (SELECT CITY, NAME FROM CUSTOMER2)
The supported query is:
(SELECT NAME, CITY FROM CUSTOMER1) UNION (SELECT NAME, CITY FROM CUSTOMER2)

Table Parameter Support

Table parameters extend SQL-92 by providing the ability to add parameters to SQL FROM clauses. For example, in SQL you can encounter a situation where it is necessary to code an exact number of parameters (highlighted) into a query.

In the following query test.rtlall.CUSTOMER is the entire customer table.

SELECT cust.CUSTOMER_ID, cust.FIRST_NAME, cust.LAST_NAME
FROM test.rtlall.CUSTOMER cust
where cust.CUSTOMER_ID in (?, ?, ?, ...)
and cust.LAST_NAME in (?, ?, ?, ... )

If a large number of parameters are involved, data entry can be slow and setting up the SQL statement tedious.

Table parameters provide an alternative. The following query uses table parameters (highlighted):

SELECT cust.CUSTOMER_ID, cust.FIRST_NAME, cust.LAST_NAME
FROM ? as id_cust(id_cust_num), test.rtlall.CUSTOMER as cust ,
? as id_cust(last_name)
WHERE id_cust.id_cust_num = cust.CUSTOMER_ID
and cust.LAST_NAME = id_cust.last_name

The table parameter is specified through the same mechanism as a a parameter; a question mark ("?") is used in place of the appropriate table name.

Note: In the current implementation only a single table column can be passed as a table parameter. If more than one column is specified, an exception is thrown.

Use Case for Table Parameters

A scenario: a data service contains consolidated information on all recent customer orders. A sales manager has a consolidated list of all government customers in European countries. The goal is to use a data service to obtain order information for that specific set of customers.

Stepping back from the example it is easy to see the that the scenario is a common one: a join between the manager's customer list and order information. However, if the manager's customer list is long and not already available through a database, it would be convenient to be able to pass in a list of values as if it were a column in a table.

In the SQL cited above a list of customers is passed in as a table with a single column. The clause:

? as id_cust(id_cust_num)

provides a virtual table value (id_cust) and a virtual column name (id_cust_num).

Although aliasing is not mandatory, it is generally recommended since default parameter column names follow numerical sequence (0, 1, and so forth) and as such are subject to unexpected name conflicts.

The one case where defaults are appropriate is when wildcards are employed such as:

select * from ?

and other simple cases involving wildcards.

Setting Table Parameters Using JDBC

Table parameters are passed to data services through the AquaLogic Data Services Platform JDBC driver, specifically through its TableParameter class. The class (shown in its entirety in Listing 5-1) represents an entire table parameter as well as the rows it represents.

Listing 5-1 Table Parameter Interface
public class TableParameter implements Serializable {      
/**
* Constructor
*
* @schema the schema for the table
*/
public TableParameter(ValueType[] schema);

/**
* Creates a new a row and adds it to the list of rows in this table
*/
public Row createRow();
/**
* Gets the rows of this table
*/
public List/*Row*/ getRows();
/**
* Gets the schema of this table
*/
public ValueType[] getSchema();
/**
* Represents a row in the table
*/
public class Row implements Serializable {
/**
* Sets a value to a particular column
* @param colIdx the index of the column to set
* @param val the value for the column
* @exception if index is out of bounds
*/
public void setObject(int colIdx,Object val) throws SQLException;
Object getObject(int colIdx);
}
Creating Table Parameters

The following steps show how to create a TableParameter class:

  1. Instantiate TableParameter with the schema of your table.
  2. Note: At present only one column is supported.
  3. Call the createRow( ) method on TableParameter to create a new Row object representing a tuple in the table.
  4. Fill in the row object using the setObject(colIdx,val) call until all columns are set.
  5. Call createRow( ) again to create as many rows as the table requires.
JDBC Usage

TableParameters are passed through JDBC just like any other parameter, through a PreparedStatement.

For example, you would first create a PreparedStatement with the query:

SELECT cust.CUSTOMER_ID, cust.FIRST_NAME, cust.LAST_NAME
FROM ? as id_cust(id_cust_num), test.rtlall.CUSTOMER as cust ,
? as id_cust(last_name)
WHERE id_cust.id_cust_num = cust.CUSTOMER_ID
and cust.LAST_NAME = id_cust.last_name
and cust.ORDER_AMT > ?
Table Parameter Example

The following simplified example illustrates the use of a table parameter. An in-memory list contains three customers: CUST_1, CUST_2, and CUST_3.

SELECT cust.cust_num, order.item, order.price
FROM ? as cust(cust_num), Order as order
WHERE cust.cust_num = order.cust_id

The supporting JDBC code is shown in listing Listing 5-2:

Listing 5-2 JDBC Code Supporting Table Parameter Example
//first create the table parameter
ValueType[] schemaList = new ValueType[1];
schemaList[0] = ValueType.REPEATING_VARCHAR_TYPE;
TableParameter tableParam = new TableParameter(schemaList);
// then create the rows in your virtual table
// (in practice you would read data in from a file
// or some other data stream)
TableParameter.Row row1 = tableParam.createRow();
row1.setObject(1," CUSTOMER _1");
TableParameter.Row row2 = tableParam.createRow();
Row2.setObject(1," CUSTOMER _2");

// repeat for second table parameter
// (...)
// execute the query 
PreparedStatement objPreparedStatement = objConnection.prepareStatement(
 "SELECT cust.CUSTOMER_ID, cust.FIRST_NAME, cust.LAST_NAME
FROM ? as id_cust(id_cust_num), test.rtlall.CUSTOMER as cust , ? as id_cust(last_name)
WHERE id_cust.id_cust_num = cust.CUSTOMER_ID
and cust.LAST_NAME = id_cust.last_name
and cust.ORDER_AMT > ? ");

// and set table parameters
objPreparedStatement.setObject(1,tableParam);
objPreparedStatement.setObject(2,tableParam2);
objResultSet = objPreparedStatement.executeQuery();

XML and SQL Type Mappings

When data service information is accessed from a JDBC client, the data is mapped from its XML schema format to SQL types.

The XML types are defined by:

xmlns:xs="http://www.w3.org/2001/XMLSchema"

The Java types are defined by:

java.sql.Types

XML types that can be mapped to SQL Type Mappings are shown in Table 5-2.

Table 5-2 XML and SQL Type Mapping
XML Type
SQL Types
xdt:dayTimeDuration
Types.OTHER
xdt:yearMonthDuration
Types.OTHER
xs:boolean
Types.BOOLEAN.
xs:byte
Types.SMALLINT
xs:dateTime
Types.TIMESTAMP
xs:date
Types.DATE
xs:decimal
Types.DECIMAL
xs:double
Types.DOUBLE
xs:duration
Types.OTHER
xs:float
Types.REAL
xs:hexBinary
Types.BLOB
xs:int
Types.INTEGER
xs.integer
Types.DECIMAL
xs:long
Types.BIGINT
xs:negativeInteger
Types.DECIMAL
xs:nonNegativeInteger
Types.DECIMAL
xs:nonPositiveInteger
Types.DECIMAL
xs:positiveInteger
Types.DECIMAL
xs:short
Types.SMALLINT
xs:string
Types.VARCHAR
xs:time
Types.TIME
xs:unsignedByte
Types.SMALLINT
xs:unsignedInt
Types.BIGINT
xs:unsignedLong
Types.DECIMAL
xs:unsignedShort
Types.INTEGER

 


Accessing Data Services Functions Through JDBC

The AquaLogic Data Services Platform JDBC driver enables JDBC and ODBC clients to access information available from data services using SQL. The JDBC driver increases the flexibility of the AquaLogic Data Services Platform integration layer by enabling access from database visualization and reporting tools, such as DbVisualizer, Crystal Reports, Hyperion, and Business Objects. For the client, the AquaLogic Data Services Platform integration layer appears as a relational database, with each data service function comprising a table. Internally, AquaLogic Data Services Platform translates SQL queries into XQuery.

Some constraints associated with the AquaLogic Data Services Platform JDBC driver include the following:

You can create flat views to be used from the JDBC driver to expose non-flat data services,.

This section discusses the SQL Name Mapping technique used to map SQL functions to AquaLogic Data Services Platform functions, along with the steps to configure the JDBC Driver connection using Java and non-Java applications. It includes the following topics:

About the AquaLogic Data Services Platform JDBC Driver

The AquaLogic Data Services Platform JDBC driver has the following features:

Using AquaLogic Data Services Platform JDBC Driver, you can control the metadata accessed through SQL based on the access rights set at the JDBC driver level. This ensures that authorized users can view only those tables and procedures, which they are authorized to access. However, to be able to use this feature, the AquaLogic Data Services Platform console configuration should be set to check access control. For more information, refer to the " Securing Data Services Platform Resources" section in the Administration Guide.

Note:

Data Service Functions and Corresponding JDBC Artifacts

AquaLogic Data Services Platform views data retrieved from a database in the form of data sources and functions. The following table (Table 5-3) shows the equivalent terminology.

Table 5-3 AquaLogic Data Services Platform and JDBC Driver Artifacts
AquaLogic Data Services Platform
JDBC
AquaLogic Data Services Platform Project
Database Catalog Name
Folder under the DSP project
Virtual name to maintain consistency between the database structure (Catalog.Schema.Table) and AquaLogic Data Services Platform
Function with parameters
Stored procedure
Function without parameters
Table

For example, if you have a project TestDataServices and CUSTOMERS.ds with a function getCustomers() under the schema MySchema, then you can map getCustomers as an SQL object as follows:

TestDataServices.MySchema.getCustomer

where TestDataServices is the catalog and MySchema is the name of the schema folder. This mapping is based on mapping the AquaLogic Data Services Platform functions to SQL objects. For more information about mapping AquaLogic Data Services Platform functions as SQL objects, refer to Publishing Data Services Functions for SQL Use in the Data Services Developer's Guide.

Supported Functions

AquaLogic Data Services Platform supports many functions that can be used to access data services through various reporting tools. In the following tables functions are divided into the following types:

Numeric Functions

Table 5-4 Numeric Functions
Function
Signature
Comment
ABS
numeric ABS (numeric n)
ABS returns the absolute value of n. If n is NULL, the return value is NULL.
CEIL
numeric CEIL(numeric n)

CEIL returns the smallest integer greater than or equal to n. If n is NULL, the return value is NULL.

FLOOR
numeric FLOOR(numeric n)
FLOOR returns largest integer equal to or less than n. If n is NULL, the return value is NULL.
ROUND
numeric ROUND (numeric n)
ROUND returns n rounded to 0 decimal places. If n is NULL, the return value is NULL.

The following numeric operation functions are provided:

String Functions

The following string management functions are provided:

Table 5-5 String Functions
Function
Signature
Comment
CONCAT
varchar CONCAT(varchar s1, varchar s2)

CONCAT returns s1 concatenated with s2. If any argument is NULL, it is considered to be equivalent to the empty string.

LENGTH
numeric LENGTH(varchar s)
LENGTH returns the length of s. The function returns 0 if s is NULL.
LOWER
varchar LOWER(varchar s)
LOWER returns s, with all letters lowercase. If s is NULL, the function returns an empty string.
LTRIM
varchar LTRIM(varchar s)
LTRIM trims leading blanks from s. If s is NULL, the function returns NULL.
RTRIM
varchar RTRIM(varchar s)
RTRIM trims trailing blanks from s. If s is NULL, the function returns NULL.
SUBSTR
varchar SUBSTR(varchar s, numeric start)

SUBSTR with two arguments returns substring of s starting at start, inclusive. The first character in s is located at index 1. If s is NULL, the function returns an empty string.

TRIM
varchar TRIM(varchar s)
TRIM trims leading and trailing blanks from s. If s is NULL, TRIM returns NULL.
UPPER
varchar UPPER(varchar s)
UPPER returns s, with all letters uppercase. If s is NULL, UPPER returns the empty string.

Datetime Functions

The following datetime functions are provided:

Table 5-6 Datetime Functions
Function
Signature
Comment
DAYS
numeric DAYS(T value)

DAYS returns the days component from value. T can be a date, timestamp, or duration. If value is NULL, the result is NULL.

HOUR
numeric HOUR(T value)

HOUR returns the hour component from value. T can be one of time, timestamp, or duration. If value is NULL, the result is NULL.

MINUTE
numeric MINUTE(T value)

MINUTE returns the minute component from value. T can be a time, timestamp, or duration. If value is NULL, the result is NULL.

MONTH
numeric MONTH(T value)

MONTH returns the month component from value. T can be one of date, timestamp, or duration. If value is NULL, the result is NULL.

SECOND
numeric SECOND(T value)

SECOND returns the seconds component from value. T can be a time, timestamp, or duration. If value is NULL, the result is NULL.

YEAR
numeric YEAR(T value)

YEAR returns the year component from value. T can be one of date, timestamp, or duration. If value is NULL, the result is NULL.

Aggregate Functions

The following aggregation functions are provided:

Table 5-7 Aggregate Functions
Function
Signature
Comment
COUNT
numeric COUNT(ROWS r)
COUNT returns the number of rows in r.
AVG
T AVG(T r)
AVG returns the average values of all values in r. T can be a numeric or duration type.
SUM
T SUM(T r)
SUM returns the sum of all values in r. T can be a numeric or duration type.
MAX
T MAX(T r)

MAX returns a value from r that is greater than or equal to every other value in r. T can be a numeric, varchar, date, timestamp, or duration type.

MIN
T MIN(T r)

MIN returns a value from r that is less than or equal to every other value in r. T can be a numeric, varchar, date, timestamp, or duration type.

JDBC Metadata Search Patterns

The AquaLogic Data Services Platform JDBC driver supports standard JDBC API search patterns, as shown in Table 5-8.

Table 5-8 JDBC Driver Metadata Search Patterns
Pattern
Purpose
"string"
Matches the identified string.
" "
Uses the default catalog/schema.
"%"
Wildcard; equivalent to * in regular expressions.
"_"
Matches a single character; equivalent to . (period) in regular expressions.
null
Wildcard; same as "%"

Assuming that the default_catalog is catalog1 and default_schema is schema1, Table 5-9 shows some common matching patterns.

Table 5-9 JDBC Driver Metadata Search Patterns
Pattern
Matching Example
"AquaLogic"
Matches the identified string, AquaLogic.
"abc%d"
Matches:
  • abc10d
  • abcd
  • abc_practically anything_d
But not:
  • abc10e
  • abc10def
abc%d_
Matches:
  • abc10d
  • abcd
  • abc_practically anything_d
  • abc10dg
But not:
  • abc10dgh
  • abc10dgPattern
""
and
null
A call to:
DBDatabaseMetadata.getTables("",null,"abc%")
would return all tables starting with abc under catalog 1.

Configuring the AquaLogic Data Services Platform JDBC Driver

AquaLogic Data Services Platform JDBC driver is located in an archive file named ldjdbc.jar, which is available in the following directory after you install BEA AquaLogic Data Services Platform:

<bea_home>\weblogic81\liquiddata\lib\

To use the AquaLogic Data Services Platform JDBC driver on a client computer, you need to configure the classpath, class name, and the URL for the JDBC driver. To configure the driver on a client computer, perform the following steps:

  1. Copy the ldjdbc.jar and weblogic.jar to the client computer.
  2. Add ldjdbc.jar and weblogic.jar to the computer's classpath.
  3. Set the appropriate supporting path by adding %JAVA_HOME%\jre\bin to your path.
  4. To configure the JDBC driver:
    1. Set the driver class name to:
    2. com.bea.dsp.jdbc.driver.DSPJDBCDriver
    3. Set the driver URL to:
    4. jdbc:dsp@<DSPServerName>:<DSPServerPortNumber>/<DSPApplicationName>]

      For example the driver URL would be:

      jdbc:dsp@localhost:7001/RTLApp
    5. You can also set the default catalog name and schema name in the URL while connecting to the JDBC driver with the following syntax:
    6. jdbc:dsp@<DSPServerName>:<DSPServerPortNumber>/<DSPApplicationName>/<catalogname>/<schemaname>
      Note: If you do not specify the CatalogName and SchemaName in the JDBC driver URL, then you need to specify the three-part name for all queries. For example:
      select * from <catalogname>.<schemaname>.CUSTOMER
    7. Debugging can be enabled by using the logFile property. To log debugging information, use the following JDBC driver URL syntax:
    8. jdbc:dsp@localhost:7001/test;logFile=c:\output.txt

      In this case, the log file will be created in c:\output.txt. You can also specify the debug property separately instead of specifying it with the URL.

      Note: If you build a SQL query using a reporting tool, the unqualified JDBC function name is used in the generated SQL. Consequently, when an application developer invokes an XFL database function, the default catalog and schema name must be defined in the JDBC connection URL. It is also a requirement that any JDBC connection utilize those functions available from a single SQL catalog:schema pair location.

      The following is an example URL defining a default catalog and schema for a JDBC connection:

      jdbc:dsp@localhost:7001/myApplication/myCatalog/mySchema

  5. To configure the connection object for the AquaLogic Data Services Platform application, you can specify configuration parameters as a Properties object or as a part of the JDBC URL.
Note: If application, default_catalog, or default_schema appears in both the connection properties and the URL, the one in the URL takes precedence.
Configuring the Connection Using the Properties Object:

You can configure the JDBC driver connection using the properties object as follows:

props.put("user", "weblogic");
props.put("password", " weblogic ");
props.put("application", "RTLApp");
Connection objConnection = DriverManager.getConnection("jdbc:dsp@localhost:7001", props);
Note: You can specify the default schema and catalog name using the default_catalog and default_schema property fields in case you do not specify it in the properties.

Alternatively, you can specify the AquaLogic Data Services Platform application name, RTLApp, in the connection object itself, as shown in the following snippet:

props.put("user", " weblogic");
props.put("password", " weblogic ");
Connection objConnection = DriverManager.getConnection("jdbc:dsp@localhost:7001/RTLApp",props);
Configuring the Connection in the JDBC URL:

You can also configure the JDBC driver connection without creating a properties object, as shown in the following code:

Connection objConnection =
DriverManager.getConnection("jdbc:dsp@localhost:7001/RTLApp;logFile=c:\output.txt; ", <username>, <password>);

Accessing AquaLogic Data Services Platform JDBC Driver Using a Java Application

The steps to connect an application to AquaLogic Data Services Platform as a JDBC/SQL data source are substantially the same as connecting to any JDBC/SQL data source directly. In the database URL, use the AquaLogic Data Services Platform application name as the database identifier with "dsp" as the sub-protocol, in the form:

jdbc:dsp@<WLServerAddress>:<WLServerPort>/<DSPApplicationName> 

For example:

jdbc:dsp@localhost:7001/RTLApp

The name of the AquaLogic Data Services Platform JDBC driver class is:

com.bea.dsp.jdbc.driver.DSPJDBCDriver 

Obtaining a Connection

This section describes how to connect using the driver class in a client application.

A JDBC client application can connect to a deployed AquaLogic Data Services Platform application in the same way as it can connect to any database. It loads the AquaLogic Data Services Platform JDBC driver and then establishes a connection to AquaLogic Data Services Platform.

For example:

Properties props = new Properties();
props.put("user", "weblogic");
props.put("password", "weblogic");
props.put("application", "RTLApp");

// Load the driver
Class.forName("com.bea.dsp.jdbc.driver.DSPJDBCDriver");

//get the connection
Connection con = DriverManager.getConnection("jdbc:dsp@localhost/7001", props);

Using the preparedStatement Interface

The storedQueryWithParameters method explained in this section, demonstrates how to use the preparedStatement interface using a connection object (con). It is a valid connection obtained through the java.sql.Connection interface to the WebLogic Server, which hosts AquaLogic Data Services Platform.

Note: You can create a preparedStatement for a non-parametrized query as well. The statement can also be used in the same manner.

In the method, CUSTOMER refers to CUSTOMER.ds.

public ResultSet storedQueryWithParameters() throws java.sql.SQLException
{
PreparedStatement preStmt =
con.prepareStatement (
"SELECT * FROM DataServices.MySchema.CUSTOMER WHERE CUSTOMER.LAST_NAME=?");
preStmt.setString(1,"SMITH");
ResultSet res = preStmt.executeQuery();
return res;
}

In the SELECT query, DataServices is the catalog name and MySchema is the name of the schema folder.

Note: To use the CUSTOMER table in the SELECT query, you must first map it as an SQL Object. For details, refer to Publishing Data Service Functions As SQL on page 5-2.

Using the CallableStatement Interface

Once a connection is established to a server where AquaLogic Data Services Platform is deployed, you can call a data service function to obtain data by using a parameterized data service function call.

The following method demonstrates calling a stored query with a parameter (where con is a connection to the AquaLogic Data Services Platform server obtained through the java.sql.Connection interface). In the snippet, a stored query named dtaQuery is executed where custid is the parameter name and CUSTOMER2 is the parameter value.

public ResultSet storedQueryWithParameters(String paramName) 
throws java.sql.SQLException {
	//prepare a stored query to execute
con.prepareCall("call DataServices.MySchema.getCustomerById(?) ");
call.setString(1, "CUSTOMER2");
ResultSet resultSet = call.executeQuery();
return resultSet;
Note: You can also use the prepareCall method as follows:
con.prepareCall(" { call DataServices.MySchema.getCustomerById(?)}");

Accessing Data Service Functions from DbVisualizer

You can also use the AquaLogic Data Services Platform JDBC driver from client Java applications. This is a good way to learn how AquaLogic Data Services Platform exposes its artifacts through its JDBC/SQL driver.

Note: For details on supported reporting applications and connectivity software see "Configuring the AquaLogic Data Services Platform JDBC Driver for Reporting Applications" in the Preparing to Install AquaLogic Data Services Platform chapter of the AquaLogic Data Services Platform Installation Guide.

This section describes how to connect to the driver from DBVisualizer. Figure 5-1 shows a sample application as viewed from DbVisualizer.

Figure 5-1 DbVisualizer View of DSP

DbVisualizer View of DSP

To use DBVisualizer, perform the following steps:

  1. Click StartArrow symbolAll ProgramsArrow symbolBEA WebLogic Platform 8.1Arrow symbolOther Development ToolsArrow symbolDbVisualizer.
  2. Configure DBVisualizer.
    1. Ensure that ldjdbc.jar exists in your CLASSPATH.
    2. To establish a connection with AquaLogic Data Services Platform select Driver Manager from the Database menu.
    3. Select Add CLASSPATH from the File menu of the driver manager dialog. You should see the ldjdbc.jar listed.
    4. Select ldjdbc.jar from the list and then select Find Drivers from the Edit menu of the driver manager. The Driver Manager will detect the com.bea.dsp.jdbc.driver.DSPJDBCDriver JDBC driver and display it in the list box.

    5. DbVisualizer View of DSP

    6. Close the driver manager.
  3. Add connection parameters by performing the following steps:
    1. On the right pane, select the JDBC Driver as com.bea.dsp.jdbc.driver.DSPJDBCDriver, from drop down list.
    2. For the Database URL, enter jdbc:dsp@<machine_name>:<port>/<app_name>. For example "jdbc:dsp@localhost:7001/RTLApp"
    3. Provide the user name and password for connecting to the AquaLogic Data Services Platform application.
  4. Click Connect. On completion of a successful connection, you should see the following:

  5. DbVisualizer View of DSP

  6. On the right pane of the window (see preceding figure), you can see various tabs. The Tables tab helps you view the information about the tables, including their metadata. The References tab lets you view the field information and primary key of each table.
  7. Execute ad hoc queries by activating the SQL Commander tab as shown in the following figure. Enter the SQL query and click the execute icon.

  8. DbVisualizer View of DSP

Once you have configured your ODBC-JDBC Bridge, you can use your application to access the data source presented by AquaLogic Data Services Platform. The usual reason for doing so is to connect AquaLogic Data Services Platform to the reporting tool that you need to use.

Note: For details on supported reporting applications and connectivity software see "Configuring the AquaLogic Data Services Platform JDBC Driver for Reporting Applications" in the Preparing to Install AquaLogic Data Services Platform chapter of the AquaLogic Data Services Platform Installation Guide.

Connecting to AquaLogic Data Services Platform Client Using ODBC-JDBC Bridge from Non-Java Applications

You can use an ODBC-JDBC bridge to connect to AquaLogic Data Services Platform JDBC driver from non-Java applications. This section describes how to configure the OpenLink and EasySoft ODBC-JDBC bridges to connect non-Java applications to the AquaLogic Data Services Platform JDBC driver.

Note: For details on supported reporting applications and connectivity software see "Configuring the AquaLogic Data Services Platform JDBC Driver for Reporting Applications" in the Preparing to Install AquaLogic Data Services Platform chapter of the AquaLogic Data Services Platform Installation Guide.

Using OpenLink ODBC-JDBC Bridge

The Openlink ODBC-JDBC driver can be used to interface with the AquaLogic Data Services Platform JDBC driver to query AquaLogic Data Services Platform applications with client applications, such as Crystal Reports 10, Business Objects 6.1, and MS Access 2003.

To use the OpenLink bridge, you will need to install the bridge and create a system DSN using the bridge. The following are the steps for these two tasks:

  1. Install the OpenLink ODBC-JDBC bridge (called ODBC-JDBC-Lite). For information on installing OpenLink ODBC-JDBC-Lite, refer to the OpenLink Software download page for its Single-Tier (Lite Edition) ODBC to JDBC Bridge Driver (Release 6.0) for use on Windows systems. As of this writing the page can be accessed from:
  2. http://download.openlinksw.com/download/login.vsp?pform=2&pfam=1&pcat=1&prod=odbc-jdbc-bridge-st&os=i686-generic-win-32&os2=i686-generic-win-32&release-dbms=6.0-jdbc

    WARNING: For Windows platforms, be sure to save the value of your CLASSPATH before installation.
  3. Create a system DSN and configure it for your AquaLogic Data Services Platform application by performing the following steps:
    1. Ensure that the CLASSPATH contains the following jars required by ODBC-JDBC-Lite, as well as ldjdbc.jar and weblogic.jar. A typical CLASSPATH might look like:
    2. D:\lddriver\ldjdbc.jar; D:\bea\weblogic81\server\lib\weblogic.jar;
      D:\odbc-odbc\openlink\jdk1.4\opljdbc3.jar; D:\odbc-jdbc\openlink\jdk1.4\megathin3.jar;
    3. Update your system path to point to the jvm.dll, which should be under your %javaroot%\jre\bin\server directory.
    4. Open Administrative tools Data Sources (ODBC). You should see the following:

    5. DbVisualizer View of DSP

    6. Click System DSN tab and then click Add.
    7. Select JDBC Lite for JDK 1.4 (32 bit) and click Finish.

    8. DbVisualizer View of DSP

    9. Specify the DSN name. For example, openlink-aldsp, as shown in the following figure:

    10. DbVisualizer View of DSP

    11. Click Next. Then on the next screen, enter the following in the JDBC driver field:
    12. com.bea.dsp.jdbc.driver.DSPJDBCDriver.

      Enter the following in the URL string field:

      jdbc:dsp@<machine_name>:<port>/<app_name>/<catalogname>/<schemaname>


      DbVisualizer View of DSP

    13. Select the Connect now to verify that all settings are correct checkbox. Provide the login and password to connect to the AquaLogic Data Services Platform WebLogic Server.
    14. Click Next. The screen shown below will display:

    15. DbVisualizer View of DSP

    16. Click Next. The following screen is displayed.

    17. DbVisualizer View of DSP

    18. Click Next and specify the connection compatibility parameters as displayed in the following figure.

    19. DbVisualizer View of DSP

    20. Click Next and then click Test Data Source. This screen will verify that the setup is successful.

    21. DbVisualizer View of DSP

    22. Click Finish.

Using the EasySoft ODBC-JDBC Bridge

Applications can also communicate with the AquaLogic Data Services Platform JDBC Driver using EasySoft's ODBC-JDBC Gateway. The installation and use of the EasySoft Bridge is similar to the OpenLink bridge discussed in the previous section.

To use the EasySoft bridge, perform the following steps:

  1. Install the EasySoft ODBC-JDBC bridge. Go to the EasySoft site for information about installation:
  2. Create a system DSN and configure it for AquaLogic Data Services Platform by performing the following steps:
    1. Open Administrative toolsArrow symbolData Sources (ODBC).

    2. DbVisualizer View of DSP

    3. Go to the System DSN tab and click Add.
    4. Select EasySoft ODBC-JDBC Gateway as shown in the following figure and click Finish.

    5. DbVisualizer View of DSP

    6. On the next screen, fill in the fields as follows:
    7. For classpath, enter the absolute path to the ldjdbc.jar

      For the URL enter:

         jdbc:dsp@<machine_name>:<port>/<app_name>/<catalogname>/<schemaname>

      For example:

      jdbc:dsp@localhost:7001/DataServices/Evaluation/NewSchema;logFile=c:\jdbc.log

      For the Driver class, enter:

      com.bea.dsp.jdbc.driver.DSPJDBCDriver


      DbVisualizer View of DSP

    8. Click Test. The following screen will display, indicating the connection has completed successfully.

    9. DbVisualizer View of DSP

    10. Click OK to complete the set-up sequence.

Accessing Data Services Data from Reporting Tools

This section describes how to configure the following reporting tools to use the AquaLogic Data Services Platform ODBC-JDBC driver:

Note: Some reporting tools issue multiple SQL statement executions to emulate a scrollable cursor if the ODBC-JDBC bridge does not implement one. Some drivers do not implement a scrollable cursor, so the reporting tool issues multiple SQL statements. This can affect performance.

Crystal Reports XI

This section describes the steps to connect Crystal Reports to the AquaLogic Data Services Platform JDBC driver along with information about standard configuration files that are available with AquaLogic Data Services Platform installation. It also describes the limitations of using Crystal Reports with AquaLogic Data Services Platform. It includes the following topics:

Crystal Reports Configuration File Support

Before you start using Crystal Reports with AquaLogic Data Services Platform, you must modify the default Crystal Reports configuration file, CRConfig.xml, to verify that Crystal Reports is able to access data services through JDBC.

The sample AquaLogic Data Services Platform CRConfig.xml file is provided with the standard installation of AquaLogic Data Services Platform. The sections of the configuration file that need to be modified contain the string "ALDSP". This file is located at:

<weblogic81>/LiquidData/resources/ReportingToolConfigs/CrystalReports

You cannot use the sample CRConfig.xml directly unless Crystal Reports is installed in the same directory as the path specified in the sample CRConfig.xml and AquaLogic Data Services Platform is installed in the same directory as the path specified in the sample CRConfig.xml. Therefore, you need to modify the default CRConfig.xml file available with Crystal Reports according to the sample CRConfig.xml file available with AquaLogic Data Services Platform.

Note: Although you can modify the sample CRConfig.xml file available with AquaLogic Data Services Platform, it is recommended that you modify the default Crystal Reports CRConfig.xml file based on the sample file available with AquaLogic Data Services Platform.

Table 5-10 identifies some restrictions and specifies configuration changes you need to make to your Crystal Reports configuration file when accessing data using the AquaLogic Data Services Platform JDBC driver.

Table 5-10 Crystal Reports Configuration File Support for AquaLogic Data Services Platform
Configuration File
Discussion
CRConfig.xml
  • Add the path to weblogic.jar and ldjdbc.jar to the beginning of CLASSPATH environment variable.
  • Replace the entire <JDBC> element with the sample <JDBC> element.
  • Modify the <JDBCURL> and <JDBCUserName> elements based on the JDBC driver URL and JDBC user name that you want to use to establish the connection with AquaLogic Data Services Platform JDBC driver.

The following code snippet is a sample of the <JDBC> element with the JDBC driver URL and user name configuration settings:

<!-- ALDSP2.5 : The following <JDBC configuration is specific to ALDSP. -->
<JDBC>
<CacheRowSetSize>100</CacheRowSetSize>
<!-- ALDSP: Please replace <JDBCURL> with your URL. -->
<JDBCURL>jdbc:dsp@localhost:7001/YOUR_APP</JDBCURL>
<JDBCClassName>com.bea.dsp.jdbc.driver.DSPJDBCDriver</JDBCClassName>
<!-- ALDSP: Please replace <JDBCUserName> with your user name. -->
<JDBCUserName>ENTER_USER_NAME_HERE</JDBCUserName>
<JNDIURL></JNDIURL>
<JNDIConnectionFactory></JNDIConnectionFactory>
<JNDIInitContext>/</JNDIInitContext>
<JNDIUserName></JNDIUserName>
<GenericJDBCDriver>
<Option>Yes</Option>
<DatabaseStructure>catalogs,schemas,tables</DatabaseStructure>
<StoredProcType>Standard</StoredProcType>
<LogonStyle>Standard</LogonStyle>
</GenericJDBCDriver>

</JDBC>

Limitations

Before you use Crystal Reports to access data services, ensure that you consider the following facts:

Connecting to Crystal Reports Using JDBC

To connect Crystal Reports to the JDBC driver and access data services to generate reports, perform the following steps:

  1. Crystal Reports 11.0 comes with a direct JDBC interface that can be used to interact directly with the AquaLogic Data Services Platform JDBC driver. You need to create a new connection for JDBC by selecting JDBC (JNDI) connection from the Standard Report Creation Wizard. This displays the JDBC (JNDI) Connection dialog box, as shown in Figure 5-2.
  2. Figure 5-2 Connection Dialog Box


    Connection Dialog Box

  3. Specify the connection parameters for the JDBC interface of Crystal Reports as shown in Figure 5-3.
  4. Figure 5-3 Connection Information Dialog Box


    Connection Information Dialog Box

    Note: The Database drop down box is populated with the available catalogs (AquaLogic Data Services Platform applications) once you have specified the correct parameters for User ID and Password as shown in Figure 5-3.
  5. Click Finish to go back to the Standard Report Creation Wizard.
  6. Drag the tables for which you want to generate the report to the right side as shown in Figure 5-4.
  7. Figure 5-4 Metadata Browser Window


    Metadata Browser Window

  8. Alternatively, you can choose the Add Command option to type an SQL query directly, which displays a window as shown in Figure 5-5.
  9. Figure 5-5 Add Command


    Add Command

  10. Click OK and the Command is added to the right side of the window.
  11. Clicking Next in the wizard shows you all the available views for generating the report, as shown in Figure 5-6.
  12. Figure 5-6 Link Screen


    Link Screen

  13. Click Next to go back to the Column chooser window as shown in Figure 5-7. This window allows you to select the columns you want to see in the final report.
  14. Figure 5-7 Column Chooser


    Column Chooser

    Note: This example chooses columns from the user-generated Command and the view CUSTOMER.
  15. Click Next and the Grouping screen is displayed (as shown in Figure 5-8), which allows you to choose a column to group by. (This grouping is performed by Crystal Reports. The Group-by information is not passed on to the JDBC driver.)
  16. Figure 5-8 Group-by Screen


    Group-by Screen

  17. Skip the next few screens for now. Click Next till you reach the Template Chooser Screen Figure 5-9. Choose any appropriate Template. In this example, the user has chosen the Block (Blue) Template.
  18. Figure 5-9 Template Chooser Screen


    Template Chooser Screen

  19. Click Finish. A report similar to that shown in Figure 5-10 is displayed.
  20. Figure 5-10 Generated Report


    Generated Report

Business Objects XI-Release 2 (ODBC)

Business Objects allows you to create a Universe and generate reports based on the specified Universe. In addition, you can execute pass-through SQL queries against Business Objects that do not need the creation of a Universe.

Note: If you need to specify a four part name in a SELECT list (such as, <catalogname>.<schemaname>.<tablename>.<columnname>), define a table alias using the FROM clause, and then use only two parts <tablealias>.<columnname> in the SELECT list. AquaLogic Data Services Platform JDBC driver extracts only the last two parts from the SELECT list item, and ignores the rest.
Note: For example:
SELECT C.Name FROM DataServices.MySchema.CUSTOMER C
where
DataServices is the catalog name
MySchema is the schema name
CUSTOMER is the table name
Name is the column name
C is the table alias for CUSTOMER

This section provides information on configuring Business Objects to access the AquaLogic Data Services Platform JDBC driver. It includes the following topics:

Business Objects Configuration File Support

There are two BusinessObjects configuration files, odbc.prm and odbc.sbo, available with the standard BusinessObjects installation, which need to be replaced with the odbc.prm and odbc.sbo configuration files available with AquaLogic Data Services Platform, to access data services using BusinessObjects.

When you install BusinessObjects, these files are copied to the following location:

<Business Objects Home >\BusinessObjects Enterprise 11.5\
win32_x86\dataAccess\connectionServer\odbc

With the AquaLogic Data Services Platform installation, these configuration files are available at the following location:

<weblogic81>/LiquidData/resources/ReportingToolConfigs/BusinessObjects

After installing AquaLogic Data Services Platform, save the original configuration files available with BusinessObjects at a different location and then replace them with the files packaged with AquaLogic Data Services Platform.

The BusinessObjects configuration files provided with AquaLogic Data Services Platform should be reviewed for comments. (Relevant comments contain the string "ALDSP").

Tip: When first getting started using BusinessObjects with AquaLogic Data Services Platform, it is recommended that the included configuration file be used to verify your ability to access data services through JDBC.

Table 5-11 identifies some restrictions and specifies configuration changes you may want to make to your BusinessObjects configuration files when accessing data using the AquaLogic Data Services Platform JDBC driver.

Table 5-11 Business Objects Configuration File Support for AquaLogic Data Services Platform
Configuration File
Discussion
ODBC.PRM
Specifically supported:
  • EXT_JOIN (outer join)
  • QUALIFIER (table prefix)
  • DISTINCT
  • ANSI_92
Not supported:
  • INTERSECT
  • INTERSECT_IN_SUBQUERY
  • MINUS
  • MINUS_IN_SUBQUERY
ODBC.SBO
Set Transactional Available option to YES

Prerequisites and Limitations

Before you start using Business Objects to access data services, ensure that you consider the following facts:

For details about configuring OpenLink, refer to Using OpenLink ODBC-JDBC Bridge on page 5-26.

Generating a Business Objects Report

To generate a report, perform the following steps:

  1. Create a Universe:
    1. Run the Business Objects Designer application and click New to create a new universe.
    2. Fill in a name for your Universe and select the appropriate DSN connection from the drop-down list.
    3. If the DSN you want to use does not appear in the list (this happens if you are using the application for the first time), then click New to create a new connection.
    4. In the Define a New Connection wizard, select Generic ODBC3 Datasource as the middleware.
    5. Specify the user name and password to connect to WebLogic Server and select openlink-aldsp as the DSN. For details about configuring the OpenLink ODBC-JDBC bridge, refer to Using OpenLink ODBC-JDBC Bridge on page 5-26.
    6. Click Next and test if the connection with the server is successful. Follow the instructions in the wizard to complete creating the connection.
    7. After creating the connection, specify this connection in the Universe and click OK. A new blank panel is displayed.
    8. From the Insert menu select Table. Once the list of tables is shown in the Table Browser, double click the tables you wish to put in the Universe. You should see a screen similar to that shown in Figure 5-11.
    9. Figure 5-11 Table Browser


      Table Browser

    10. Save the Universe and exit.
  2. To create a new report:
    1. Run the Desktop Intelligence application. Click New to open the New Report Wizard. Choose Specify to access data and click Begin.
    2. Choose a Universe and click Next. On the left pane, you should see the tables and their fields (columns) on expansion, as shown in Figure 5-12.
    3. Figure 5-12 Query Panel


      Query Panel

    4. Select the Universe of your choice and click Finish. Double-click a column (table-field) in the left pane to select it in the result.
    5. Click Run to execute the query. The result is displayed as shown in Figure 5-13.
    6. Figure 5-13 Business Objects Panel


      Business Objects Panel

  3. You can execute the pass-through queries as follows:
    1. In the Desktop Intelligence application, click New to create a new report.
    2. In the New Report Wizard choose Others instead of Universe.
    3. Choose Free-hand SQL and click Finish.
    4. Select the connection you made using Designer.
    5. Type in your SQL query and click Run to generate the report, as shown in Figure 5-14.
    6. Figure 5-14 Specifying the SQL Query


      Specifying the SQL Query

    7. Click Run. You should see the report shown in Figure 5-15.
    8. Figure 5-15 Business Objects Report


      Business Objects Report

Hyperion-ODBC

Hyperion allows you to generate interactive and production reports using its Interactive Reporting Studio and Production Reporting Studio. This section describes the steps to access AquaLogic Data Services Platform data sources using an ODBC-JDBC bridge and generate interactive and production reports.

It includes the following topics:

Limitations

Before you start using Hyperion to access data services, ensure that you consider the following facts:

Using Hyperion Production Reporting Studio

To establish the connection and view results using the Hyperion Production Reporting Studio, perform the following steps:

  1. Open Production Reporting Studio and select the tabular report from the Create New Report wizard.
  2. Select the bridge you want to use to connect to AquaLogic Data Services Platform from the Data Connection box and click OK.
  3. Note: To create reports using Hyperion Production Reporting Suite, you need to use lower case names for tables published in AquaLogic Data Services Platform. See Publishing Data Services Functions for SQL Use in Data Services Developer's Guide for further details on how tables are published in AquaLogic Data Services Platform.
  4. If you want to create a new connection, click New and follow the instructions in the Create Data Connection wizard. Select the provider as ODBC. For more information about configuring OpenLink or EasySoft as your preferred ODBC-JDBC bridge, refer to Using OpenLink ODBC-JDBC Bridge on page 5-26 or Using the EasySoft ODBC-JDBC Bridge on page 5-30.
  5. Follow the instructions to create the new data connection and select ODBC and the SQR database. Specify the user name and password for authentication.
  6. From the Query Builder - Tables dialog box, select the tables that you want to use to generate the report and click Next.
  7. Select the query fields, which you want to use to generate the report and follow the instructions in the Query Builder configuration.
  8. Click Finish and a layout of the report is displayed. Now, run the report by clicking Process and save the report. The report is displayed as shown in Figure 5-16.
  9. Figure 5-16 Report in Hyperion Production Reporting Studio


    Report in Hyperion Production Reporting Studio

Using Hyperion Interactive Reporting Studio

To generate reports using Interactive Reporting Studio, perform the following steps:

  1. Open Interactive Reporting Studio and select to create a new database connection. Specify ODBC as the type of connection and the database.
  2. Select Easysoft or Openlink as the bridge and specify the credentials to connect to the data source using the Database Connection Wizard. The rest of the steps to create a new connection are the same as followed in production reports. After you create the connection, a blank layout is displayed.
  3. Add the tables to the query area and then drag and drop the columns for which you want to retrieve the data in the Requests field. You can also set the filter for the query using the Filter field.
  4. Run the report by clicking Process Current as shown in Figure 5-17, and then save the report.
  5. Figure 5-17 Report in Hyperion Interactive Reporting Studio


    Report in Hyperion Interactive Reporting Studio

Microsoft Access 2003-ODBC

This section describes the procedure to connect Microsoft Access 2003 to AquaLogic Data Services Platform through an ODBC-JDBC bridge. It includes the following topics:

Limitations and Usage Notes
Generating Reports Using MS Access

To connect MS Access to the bridge, perform the following steps.

  1. Run MS Access, click FileArrow symbolOpen, then select ODBC Databases as the file type as shown in the Figure 5-18.
  2. Figure 5-18 Selecting the ODBC Database in Access


    Selecting the ODBC Database in Access

  3. Once the dialog Select Data Source pops up, click Cancel to close it. You should see the window shown in Figure 5-19.
  4. Figure 5-19  OBDC23: Database Screen


     OBDC23: Database Screen

  5. Click Queries, then Design as indicated in Figure 5-19. You should see a screen as shown in Figure 5-20.
  6. Figure 5-20 Select Query and Show Table Screens


    Select Query and Show Table Screens

  7. Close the Show Table dialog box. You should now be able to see the Select Query window.
  8. Right-click in the window and select SQL SpecificArrow symbolPass-Through as shown in Figure 5-21.
  9. Figure 5-21 Selecting SQL Specific and Pass Through


    Selecting SQL Specific and Pass Through

  10. Type in your SQL query and click Run, as shown in the Figure 5-22.
  11. Figure 5-22 Running the SQL Query


    Running the SQL Query

  12. In the dialog box that is displayed (as shown in Figure 5-23), move to the Machine Data Source tab and select openlink-aldsp to connect to AquaLogic Data Services Platform JDBC driver and generate the report.
  13. Figure 5-23 Selecting the DSN for the Database


    Selecting the DSN for the Database

Microsoft Excel 2003-ODBC

This section describes the procedure for connecting Microsoft Excel 2003 to AquaLogic Data Services Platform through an ODJB-JDBC bridge using EasySoft.

To connect MS Excel to AquaLogic Data Services Platform, perform the following steps:

  1. Start Workshop for WebLogic and then start WebLogic Server.
  2. Build and deploy the AquaLogic Data Services Platform application.
  3. Start Microsoft Excel and open a new worksheet.
  4. Click Data Arrow symbolImport External Data Arrow symbolNew Database Query. The Choose Data Source dialog box is displayed.
  5. Select EasyDemo from the list of data sources and then click OK. The Query Wizard - Choose Columns dialog box is displayed. For details on configuring the JDBC driver using EasySoft, refer to Using the EasySoft ODBC-JDBC Bridge on page 5-30.
  6. Select the tables for which you want to generate the report and click Next.
  7. Follow the Query Wizard instructions and in the Query Wizard - Finish dialog box, select Return Data to Microsoft Office Excel.
  8. Click Finish and import the data in a new MS Excel spreadsheet. The query results will be displayed in the spreadsheet as shown in Figure 5-24.
  9. Figure 5-24 Query Results Displayed in MS Excel


    Query Results Displayed in MS Excel

Limitations

When passing a generated SQL string to Excel, there are situations where Excel inserts single quotes around an alias, resulting in an exception from the AquaLogic Data Services Platform JDBC driver. Here is an example:

SELECT Sum(CREDIT.AMOUNT) AS 'Sum of AMOUNT' FROM Xtreme.CREDIT CREDIT

Although you can edit your query post-generation, another option is to install a patch from Microsoft which is designed to address the problem. The current URL for accessing information on this problem and patch is:


http://support.microsoft.com/kb/298955/en-us

 


Using the Query Plan Viewer Utility

You can review the plan for the execution of a SQL query or XQuery using a standalone Query Plan Viewer utility. The functionality is similar to that described in "Using Query Plan View" in the Testing Query Plan Functions and Viewing Query Plans chapter of Data Services Developer's Guide.

Note: In order to use this utility some components must be installed and an authorized log-in to an AquaLogic Data Services Platform-enabled application provided.

Installing Query Plan Utility Components

In the absence of a full installation of AquaLogic Data Services Platform, a specific set of component files must be installed to run the Query Plan Viewer utility. Default locations for these are assumed, but these default can be easily modified.

Table 5-12 Default Location of Query Plan Utility Component Files
File
Default location
  • aldspqpv.cmd (windows)
  • aldspqpv.sh (unix/linux)
/liquiddata/bin
  • aldspqpv.jar
  • ldjdbc.jar
<weblogic_home>/liquiddata/lib
  • wlclient.jar
<weblogic_home>/server/lib

You can adjust the default location settings by editing the aldspqpv.cmd (Windows) or aldspqpv.sh (unix/linux) files.

Command Line Syntax

The command line syntax for the Query Plan Viewer utility is:

Java -classpath [path1/]wlclient.jar;[path2/]ldjdbc.jar;[path3/]aldspqpv.jar
com.bea.dsp.client.ui.shell.Shell
[Server host name][Server port number][Application name]
[User id][Password]

Here is an example using default settings:

Java -classpath ../../server/lib/wlclient.jar;../lib/ldjdbc.jar;../lib/aldspqpv.jar

com.bea.dsp.client.ui.shell.Shell

localhost 7001 RTLApp weblogic weblogic

Invoking the Query Plan Viewer Utility

Once your classpath is properly set you can invoke the Query Plan Viewer utility from the command-line using either:

On Windows systems you can easily associate the invocation command by associating a start menu option with aldspqpv.cmd.

Query Plan Viewer Login Dialog

Before you can view query plans, you need to log in to an AquaLogic Data Services Platform-enabled server (Figure 5-25).

Figure 5-25 Query Plan Viewer Login Dialog
Query Results Displayed in MS Excel

In the dialog enter the following information:

Once you have logged into the Query Plan Viewer, all information but the password is saved on your system.

Entering an SQL Query or XQuery

Once you login to your server successfully, you are ready to enter a query by selecting whether to enter either an SQL query or an XQuery.

Figure 5-26 Selecting a Query Type

Selecting a Query Type

Note: Functionally choosing XQuery or SQL Query is equivalent to selecting Ad hoc XQuery or Ad hoc SQL Query in Query Plan View in the data service development environment.

For details on entering an XQuery or SQL Query and working with the resulting query plan, see Creating Ad Hoc Queries in the Data Services Developer's Guide.

Additional Query Plan Viewer Utility Options

The utility offers several options, available from its File menu. The options are described in Table 5-13.

Table 5-13 Query Plan Viewer Utility Options
Option
Usage
Open Query Plan from File
This option opens a dialog where you can enter the name of a query plan that has been previously saved.
Connect
Opens or reopens the Query Plan Viewer connection dialog box.
Disconnect
Disconnect the current server session.
Print
Opens a standard dialog box that allows you to print the current query plan.
Save to File
Opens a standard dialog box that allows you to save the current query to an XML format file.
Exit
Quits the Query Plan Viewer utility.


  Back to Top       Previous  Next