• Topic
  • Discussion
  • VOS.VOSJNet(Last) -- DAVWikiAdmin? , 2017-06-13 05:44:04 Edit WebDAV System Administrator 2017-06-13 05:44:04

    Hosting Java and .NET

    Virtuoso allows extending server side logic using either Java or .net bound languages. Complex algorithms may be more easily expressedin Java or C# than in SQL, while Virtuoso's SQL procedure language remains the most effective means of implementing purely database-oriented server-side logic. Also using Java or .NET languages provides access to a vast library of ready-made functionality.

    Mapping Object Classes to SQL

    Java or .NET logic is imported into the server by declaring a set of SQL classes (user defined types) to have an external implementation. More conveniently, a .jar or .NET assembly can be imported as a unit. This causes the whole class-hierarchy of the imported unit to be mapped into a corresponding hierarchy of SQL UDTs. All data members become members of the SQL UDTs and all methods become methods of the UDT.

    Once this is done, making a new instance of the user-defined type from SQL will make the corresponding Java or .NET instance in the virtual machine. Calling any method of the instance will likewise call the corresponding method inside the Java or .NET virtual machine.

    Such hosted objects can be passed without restriction between SQL procedures and methods and hosted Java or .NET code. All scalar data types are automatically converted to the closest equivalent when passing between SQL and Java or .NET.

    Storing Objects

    A column of a table can be declared to be of a hosted type. To do this, simply specify the SQL name of the Java or .NET class as the column type. Instances of said class or subclasses thereof will be acceptable values as long as they are serializable. All serialization and deserialization is transparent. If the serialization is expected to be long, the UDT column may be declared long, meaning that a LOB is used for storing the content if the content does not fit on the row.

    Invoking Methods

    A method defined in a hosted language can be called identically to a native SQL method.


    The degree of "sandbox" enforced on hosted Java and .NET code is configurable at class-import time. Generally, operations in hosted languages should not start new threads, should not access the calling database except via a special in-process client and should return in a relatively short time.

    CategoryWebSite CategoryVirtuoso CategoryOpenSource