Sedna Logo Background
 
Home  |  Getting Started  |  Documentation  |  Demo  |  Download  |  Support  

Sedna Quick Start

This guide the fastest way to understand basic facilities of the Sedna XML Database. It provides a number of easy exampes which can be run directly in command line and describes how to run examples provided with Sedna.

In case of differences between the Windows and Unix (Linux, FreeBSD, MacOS, etc) versions of Sedna they are marked with [win:] and [nix:] respectively.

In this guide INSTALL_DIR refers to the directory where Sedna is installed.

Contents:

See also:

Download and Install Sedna

Download a copy of the prebuilt binaries for your machine, or get a copy of the sources and compile them yourself (download page).

Installing Sedna from binaries is easy, you just need to unzip archive (on Windows) or run self-extracting script (on Unix). For more information on installation see Sedna Installation Guide or INSTALL file in the root of your Sedna distribution.

Start and Shutdown Sedna

To start Sedna server go to INSTALL_DIR/bin and run:

se_gov

To shutdown Sedna server run:

se_stop

Create and Run a Database

To create a database named testdb:

se_cdb testdb

To run the testdb database:

se_sm testdb

To shutdown the testdb database:

se_smsd testdb

You can find more information on how to configure databases in Administration Guide.

Run Queries via Command Line

You can run queries in Sedna either via command line or via Sedna API. To get started with writing programs that work with Sedna API, see Getting Started With C API.

To run queries via command line:

[win:] se_term -query "let $a:=(3, 1, 7) return <result>{ max($a) }</result>" testdb
[nix:] se_term -query "let \$a:=(3, 1, 7) return <result>{ max(\$a) }</result>" testdb

or put your XQuery query in a file (for example 1.xquery) and run:

se_term -file 1.xquery testdb

se_term prints result of the query on the screen. With se_term you can also execute queries in interative mode. Just run:

se_term testdb

and print your queries. Use ampersand and line feed to terminate the query. (&newline terminates the query). Read more about se_term features in Administration Guide.

Run Command Line Examples

Sedna distribution comes with an example set based on the XMark XML benchmark. This set allows you to investigate the features of Sedna easily. Examples include bulk load of a sample XML document and a number of sample XQuery queries and updates to this document. Below we will show how to run one of them.

Examples are located in the directory:

[win:] INSTALL_DIR\examples\commandline
[nix:] INSTALL_DIR/examples/commandline

To run the example, type the following commands in the command prompt:

  1. Change the current directory to the directory where the example is located by typing in a command line:
    [win:] cd INSTALL_DIR\examples\commandline
    [nix:] cd INSTALL_DIR/examples/commandline
  2. Start Sedna by runing the following command:
    se_gov
    If Sedna is started successfully it prints "GOVERNOR has been started in the background mode".

  3. Create a new database auction by running the following command:
    se_cdb auction
    If the database is created successfully it prints "The database 'auction' has been created successfully".

  4. Start the auction database by running the following command:
    se_sm auction
    If the database is started successfully it prints "SM has been started in the background mode".

  5. Load the sample XML document into the auction database by typing the command:
    se_term -file load_data.xquery auction
    If the document is loaded successfully it prints "Bulk load succeeded".

  6. Now you can execute the sample queries by typing the command:
    se_term -file <query_name>.xquery auction
    where <query_name>.xquery is the name of a file with the sample query. For instance, to execute sample01.xquery you should type:
    se_term -file sample01.xquery auction
    It prints the query result.

  7. Stop Sedna by running the following command:
    se_stop