This tutorial shows you, step by step, how to configure the Oracle Berkeley DB XML support in <oXygen/> XML Editor, browse and edit resources stored in the database, as well as writing, running and debugging XQuery interrogations.
Oracle Berkeley DB XML is an open source, embeddable XML database with XQuery-based access to documents stored in containers and indexed based on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB and inherits its rich features and attributes. A detailed description can be found at: http://www.oracle.com/database/berkeley-db/xml/index.html
The tutorial assumes that you have a basic knowledge of databases, XML technologies and of <oXygen/> XML Editor tool. The explanations and screen shots are given for the standalone version of <oXygen/> XML Editor. However the same set of features are available in Eclipse plugin version of the product with minor interface differences.
There are two notions you need to understand in order to configure the Oracle Berkeley DB XML support in <oXygen/>: the data source and the connection.
A data source defines all that is needed in order to have a connection to the database. <oXygen/> currently supports Oracle Berkeley DB XML version 2.5 or higher.
Go to <oXygen/>'s Preferences->Data Sources and press the New button in order to add a new data source. Insert a data source name (make sure that each data source has an unique name) and select the Berkeley DBXML type from driver type combo box.

These jar files are found in the jar subdirectory of your Berkeley DB XML installation directory (for example on Windows C:\Program Files\Oracle\Berkeley DB XML <version>)
More information about configuring a Berkeley DB XML datasource can be found in the user manual:http://www.oxygenxml.com/doc/ug-editor/tasks/configure-berkeley-datasource.html#configure-berkeley-datasource
Once you have created the data source you may proceed further by defining one or more connection based on it. The connections can be configured on the same Preferences->Data Source page.

You need to choose a unique connection name and set the Data Source combo box to the already configured Berkeley DB XML data source. In the Environment home directory field you need to specify a directory location where your existing environment is stored or a directory where you would like to create a new environment.
Once you finished the configuration of the connection you are able to browse the database content using the Datasource Explorer view from the Database perspective.
Each node from the datasource explorer view features a set of operations that are available on the contextual menu. One of the operations available on the connection node is the possibility to add a new container.

The contextual menu of a container node features operations like add resource, rename, delete or edit indices.
A database resource node features the following list of operations: rename, move, delete or open the content to be edited in <oXygen/>. When the editor content is saved, the changes are stored back in the database.
<oXygen/> runs XQuery interrogations against the stored XML content of a Berkeley DB XML database as a transaction through the transaction support of the server. For example if you want to create an XQuery to generate a report with the billing contact data from the latest purchase notifications, you can open an XQuery editor (New->XQuery), configure the transformation scenario to match the Berkeley DB XML connection for the transformer field, write the XQuery and then run the scenario.
The XQuery editor features a new XQuery outliner as well as powerful content completion including descriptions of Berkeley DB XML predefined functions.
The debugging interface of Oracle Berkeley DB XML 2.5 database has been integrated with the <oXygen/> XQuery Debugger and Profiler. All the debugging and profiling views (stack, trace, conditional breakpoints, breakpoints, hotspots, invocation tree, etc..) are available.
When entering in the XQuery Debugging mode <oXygen/> provides a special layout that display the XML source (optional) and the XQuery documents side by side. It can also show the debugging output and specific XQuery debugging views and toolbars that allow you to set breakpoints, inspect variable bindings, evaluate expressions in the request context.
More details about the <oXygen/> Xquery Debugger can be found here: http://www.oxygenxml.com/xquery_debugger.html
Two special views (Hotspots and Invocation Tree) allows profiling of the XQuery execution.
More details about the <oXygen/> Xquery Profiler can be found here: http://www.oxygenxml.com/doc/ug-editor/topics/working-with-XSLT-profiler.html
