Neoview Workload Management Services Guide (R2.3)

For more information about using the JDBC Type 4 driver, see the Neoview JDBC Type 4 Driver
Programmer's Reference.
Using the SET SERVICE Statement to Associate Queries With a Service
SET SERVICE Statement
In NCI or in an ODBC or JDBC client application, use the SET SERVICE statement to associate
SQL queries with a service.
In NCI, in SQL mode only, you can enter SET SERVICE interactively in the command-line
interface, or you can put the SET SERVICE statement in a script file that you run in NCI. For
example, this SET SERVICE statement sets the service name to DATALOADING in a script file
that you run in NCI:
set service dataloading;
create schema persnl;
create table employee...
IMPORTANT: If the service name contains multibyte characters, enclose the service name in
double quotes in the SET SERVICE statement to ensure correct translation. For guidelines on
using multibyte character sets, see the Neoview Character Sets Administrator's Guide.
If the service that you specify does not exist, WMS first looks for a service name that matches
the second part of the client role, such as MGR in ROLE.MGR. If WMS finds a service name that
matches the role, WMS manages the queries in that service. If WMS does not find a service name
that matches the role, WMS manages queries in the default service, HP_DEFAULT_SERVICE.
In an ODBC or JDBC client application, you can use the SET SERVICE statement as you would
any other SQL SET statement. This example shows SET SERVICE in an ODBC application:
sprintf(stmt, "SET SERVICE %s", servicename);
retcode = SQLExecDirect(hstmt, stmt, SQL_NTS);
This example shows SET SERVICE in a JDBC application:
Connection conn = DriverManager.getConnection("jdbc:default:connection");
Statement stmt = conn.createStatement();
stmt.execute("set service dataloading");
In a client application, the SET SERVICE statement takes precedence over a
SQLSetConnectAttr() or setServiceName() setting.
For more information about SET SERVICE, see the Neoview SQL Reference Manual.
GET SERVICE Statement
The GET SERVICE statement shows the service that is in effect for the current session and whether
the SQL plan or SQL text are enabled for that service. You can use GET SERVICE in NCI or in
an ODBC or JDBC client application. For example, in NCI:
SQL>get service;
CUR_SERVICE PLAN TEXT
-------------------------------------------------- ----------- -----------
HP_DEFAULT_SERVICE 0 0
--- SQL operation complete.
SQL>
If you did not explicitly set a service for the session, GET SERVICE shows that the default service,
HP_DEFAULT_SERVICE, is in effect:
38 Associating Queries With Services