Chapter 18. Runtime Hosting
Abstract
Virtuoso can be extended by in-process hosting of a number of different run time environments. This includes: Microsoft's .NET CLR (CLR), the Mono ECMA-CLI (Mono), and the Java Virtual Machine (JVM). Thus, you can create persistent stored modules, SQL functions, and user defined data types using any Microsoft .NET or Mono bound language, Java, and traditional languages such as 'C'/C++.
Objects provided by hosted run times, such as Java and CLR can be directly and transparently accessed from SQL. This also means that application logic in any hosted language can be exposed as a web service. By offering a choice of hosted run times in a cross platform setting, Virtuoso adds a new degree of freedom for the application designer. Applications can now be developed and deployed on either Windows, Linux or Unix, can be written in Java or any .net CLR bound language and can talk to any database via Virtuoso's virtual databasing capabilities.
The Virtuoso Server Extension Interface (VSEI) provides C interfaces and hooks that enable developers to write external functionality that can be bolted on the side of Virtuoso and called as SQL functions.
Table of Contents
- 18.1. Runtime Environments
- 18.2. CLR, .Net & ASPX Host
-
- 18.2.1. Environment Setup
- 18.2.2. Testing the Virtuoso .NET Runtime Environment
- 18.3. CLR & Mono
-
- 18.3.1. Environment Setup
- 18.3.2. Testing the Virtuoso Mono Runtime Environment
- 18.4. Embedded Java VM API
-
- 18.4.1. Correspondence Between Virtuoso & Java VM Threads
- 18.4.2. Virtuoso/PL <-> Java VM Type Mapping Schema
- 18.4.3. References to Java VM Class Instances in Virtuoso/PL
- 18.4.4. Specifying the Correct Java Type When Passing Values from Virtuoso/PL
- 18.4.5. Virtuoso Java PL API VSEs
- 18.4.6. Java Security
- 18.5. Virtuoso Server Extension Interface (VSEI) (C Interface)
-
- 18.5.1. Virtuoso Server Extension Interface (VSEI)
- 18.5.2. SQL Run Time Objects
- 18.5.3. Memory Management Rules
- 18.5.4. Server Main Function
- 18.5.5. Compiling & Linking
- 18.5.6. Functions by Category
- 18.5.7. VSEI Definition
- 18.5.8. SQL Exceptions
- 18.5.9. Executing SQL
- 18.5.10. Adding New Languages And Encodings Into Virtuoso
- 18.6. VSEI Plugins
18.1. Runtime Environments
The Virtuoso server in its standard build is a single executable. To allow for external customizations based on VSEs the Virtuoso server engine becomes a callable library, the main function is re-written to incorporate other libraries and a new executable is created. For example, a Virtuoso server that contains PHP support under Windows consists of:
65K virtuoso-odbc-php-t.exe 5.2M libvirtuoso-odbc-t.dll 1.2M php4ts.dll
which replaces the usual 7M virtuoso-odbc-t.exe
.
virtuoso.odbc-php-t.exe
is then executed
in the usual way.
The Linux counterpart would be an
8M virtuoso-odbc-php-t
binary.
The Virtuoso executable files provided in the installer are appropriately named to indicate which customizations are supported. e.g. one that contains "php" and "clr" in the file name has been built with PHP and CLR support.
The location of the support libraries (.DLL's) for the various customizations of Virtuoso on Windows must either be in the %PATH%; environment variable or be the same directory as the virtuoso .EXE file. Virtuoso will not be able to start otherwise.
Note: | |
---|---|
If Virtuoso is starting as a system service then the SYSTEM PATH must be altered as opposed to the USER PATH. The USER PATH is appropriate to alter if Virtuoso is being started as that user, usually when in debug/foreground mode. This is applicable to any required environment variables, not just PATH. |
Hosted environments that require SQL access back to the database can make use of the in-process client mechanism. Hosted Runtimes such as PHP and ASP .Net would ordinarily use an RPC based (ODBC) connection. To improve the efficiency of the system, keeping it all in-process, a special connection can be made with no alteration to the API used in the code for communication.
See Also: | |
---|---|
The In-Process Client keeps connections within Virtuoso avoiding unnecessary RPCs. |