# 20. Using Virtuoso with Tuxedo

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Using Virtuoso with Tuxedo
Building the Transaction Manager Server
Configuration
Services
Introduction VQL functions Services concept OPENINFO
Clients
Service example

## 20.3. Services

### 20.3.1. Introduction

The services (in the Tuxedo's term) are special programs which implement business logic. The services could be in the context of a global XA transaction, in this case 2PC control will be set in motion. Each service which uses Virtuoso as resource manager has hdbc connection to the Virtuoso server. This connection is automatically opened when service activated. The connection string (OPENINFO) to the Virtuoso server is the connection string of the group of the service (see GROUPS section in the sample config file). The OPENINFO has the following format: "Virtuoso:user:password@NODENAME:port". The user,password and port are optional.

### 20.3.2. VQL functions

VQL functions are used to receive access to hdbc for further work with the Virtuoso server. Only HDBCs received by the VQL functions are operated in the context of the distributed transactions.

int vql_get_connection (HDBC * hdbc, int type); returns result of setting hdbc to current hdbc connection. "type" argument indicates which hdbc is to select, currently only VQL_CTX_TYPE is supported, other values are reserved.

int vql_get_env (HENV * env); returns result of setting current ODBC environment.

Header: vql_client.h

Library: libvirtxa.a

### 20.3.3. Services concept

Each service has an entry point (some function), which is supposed to perform the application task. The result of whole transaction depends on result of the service's entry function. The scenario of typical workflow is as follows:

- client begins global transaction by ATMI tpbegin() call,
- client calls the service N1 to update some tables on the first Virtuoso server (resource manager),
- client calls the service N2 to update some tables on the second Virtuoso server (resource manager),
- client finishes global transaction by either tpcommit() or tpabort() call of ATMI.

The tx_* functions also could be used, See TUXEDO TxRPC related or ORACLE XA documentation.

- tx_begin()
- tx_commit()
- tx_open()

Services can be built with the following command: buildserver -v -f virt_service1.o -o VirtService1 -r Virtuoso -s VService1 where "virt_service1.o" is the service object file which contains VService1 entry function. "-r Virtuoso" indicates that service must be assembled with Virtuoso XA support library.

### 20.3.4. OPENINFO

OPENINFO is necessary for services to connect to the certain Virtuoso server. OPENINFO for the services (see GROUPS section in the example) consists of 2 parts: "Virtuoso" term and connection string. Connection string provides the service name, password, server and port of Virtuoso server. Common format of connection string is [USER[:PASSWORD]]@SERVER[:PORT]. Only the SERVER name is required, the others are optional.

Previous Configuration | Chapter Contents | Next Clients