Difference between revisions of "Startup"

From BaseX Documentation
Jump to navigation Jump to search
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This article is part of the [[Getting Started]] Guide. It tells you how to get BaseX running.
 
This article is part of the [[Getting Started]] Guide. It tells you how to get BaseX running.
  
==Getting Started==
+
=Getting Started=
 +
 
 +
BaseX is very light-weight. It can be run and used in various ways:
 +
 
 +
* as standalone application, using the [[#Standalone|Standalone]] mode or the [[#Graphical User Interface|Graphical User Interface]],
 +
* as [[#Client/Server|Client/Server]] application, or
 +
* as [[#HTTP Server|Web Application]], called from a web server.
 +
 
 +
It can also be embedded as a library in your own application.
  
 
First of all, [http://basex.org/download download] BaseX from our homepage.
 
First of all, [http://basex.org/download download] BaseX from our homepage.
 
The following distributions are available:
 
The following distributions are available:
  
* the '''Core Package''' is a JAR file, which contains the database code, the query processor and the GUI frontend. It runs completely without additional libraries.
+
==Distributions==
* the '''ZIP Archive''' and the '''Windows Installer''' contain libraries for web applications and advanced features, [[Start Scripts]], and some additional optional files.
 
* the '''WAR Archive''' can be embedded in existing Java web servers.
 
  
Some additional distributions are available from the download page,
+
===Core Package===
most of which contain only the core package and, optionally, scripts for starting BaseX.
 
  
BaseX is very light-weight. It can be run and used in various ways:
+
The '''Core Package''' is a small JAR file. It contains the database system, the XQuery processor and the graphical user interface. It does not require any additional libraries.
 +
 
 +
===Full Distributions===
 +
 
 +
The '''ZIP Package''' and the '''Windows Installer''' contain the BaseX core library and extra libraries for web applications and advanced features, [[Start Scripts]], and some additional optional files.
 +
 
 +
After BaseX has been unzipped or installed, the following directories will be available:
 +
 
 +
* {{Code|bin/}}: Start scripts (Windows, Linux).
 +
* {{Code|data/}}: Database directory. See [[Configuration]] for more details.
 +
* {{Code|etc/}}: Example data: XML sample, [[Catalog Resolver|catalog and DTD files]].
 +
* {{Code|lib/}}: Extra libraries (Jetty, Tagsoup, …).
 +
* {{Code|lib/custom/}}: Directory, in which additional JAR files can be placed (such as the Saxon library).
 +
* {{Code|repo/}}: [[Repository]] (the [http://www.xqueryfunctions.com FunctX] library is included as example).
 +
* {{Code|src/}}: Directory for your XQuery scripts and other source data.
 +
* {{Code|webapp/}}: [[Web Application]] directory: RESTXQ web application, REST scripts, [[DBA]].
 +
 
 +
If BaseX is started via the start scripts or the Windows icons, all JAR files in the {{Code|lib}} directory and its descendant directories will be added to the classpath.
 +
 
 +
If you work with the ZIP distribution, and if you want to make BaseX globally available, you can add the {{Code|bin}} directory to your PATH environment variable.
 +
 
 +
===Web Archive===
 +
 
 +
The '''WAR Archive''' can be embedded in existing Java web servers.
  
* as standalone application, using the [[#Standalone|Standalone]] mode or the [[#Graphical User Interface|Graphical User Interface]],
+
===Other Distributions===
* as [[#Client/Server|Client/Server]] application, or
 
* as [[#Web Application|Web Application]], called from a web server.
 
  
It can also be embedded as a library in your own application.
+
Various other distributions are available from the download page, most of which contain only the core package and, optionally, scripts for starting BaseX.
  
====Requirements====
+
==Requirements==
  
BaseX is platform-independent and runs on any system that provides an implementation of [http://www.java.com Java] (JRE).
+
BaseX is platform-independent and runs on any system that provides an implementation of the [http://www.java.com Java Runtime Environment (JRE)]:
Since <b>Version 8.0</b> of BaseX, Java 7 is mandatory, because it provides better file handling support,
+
* Since <b>Version 9</b> of BaseX, Java 8 is required.
and because Oracle stopped public support for older versions.
+
* Since <b>Version 8</b>, Java 7 is required.
 +
* Older versions are based on Java 6.
  
 
BaseX has been tested on several platforms, including Windows (2000, XP, Vista, 7), Max OS X (10.x),
 
BaseX has been tested on several platforms, including Windows (2000, XP, Vista, 7), Max OS X (10.x),
 
Linux (SuSE xxx, Debian, Ubuntu) and OpenBSD (4.x).
 
Linux (SuSE xxx, Debian, Ubuntu) and OpenBSD (4.x).
  
====Concurrent Operations====
+
==Concurrent Operations==
  
If you plan to perform concurrent read and write operations on a single database, you
+
If you want to perform parallel (concurrent) read and write operations on your databases, you must use the client/server architecture or deploy BaseX as web application. You can safely open a database in different JVMs (Java virtual machines) for read-only access, and you will not encounter any problems when reading from and writing to different databases, but update operations from different JVMs to the same database will be rejected or may even lead to corrupt databases.
should use the client/server architecutre or deploy it as web application.
 
You may safely open the same database in different JVMs (Java virtual machines) for
 
read-only access, and you won’t encounter any problems when reading from or writing
 
to different databases, but your update operations will be rejected if the database
 
to be written to is currently opened by another virtual machine.
 
  
==Standalone==
+
For example, if you only read data, you can easily run several clients (standalone, GUI, database clients) at the same time. If you update your data, however, you shouldn’t use the GUI or a standalone instance at the same time.
  
The [[Standalone Mode]] can be used to execute XQuery expressions or run database commands on command line. It can also be used both for scripting and batch processing your XML data. It can be started as follows (get more information on all [[Command-Line Options#BaseX Standalone|Startup Options]]):
+
More details on concurrency are found in the [[Transaction Management]] article.
 +
 
 +
=Standalone=
 +
 
 +
The [[Standalone Mode]] can be used to execute XQuery expressions or run database commands on command line. It can also be used both for scripting and batch processing your XML data. It can be started as follows (get more information on all [[Command-Line Options#Standalone|Startup Options]]):
  
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basex]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basex.bat]]}} scripts.
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basex]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basex.bat]]}} scripts.
Line 49: Line 75:
 
It is important to remember that the standalone mode does ''not'' interact with the [[#Client/Server|Client/Server]] architecture.
 
It is important to remember that the standalone mode does ''not'' interact with the [[#Client/Server|Client/Server]] architecture.
  
==Graphical User Interface==
+
=Graphical User Interface=
  
 
The [[GUI]] is the visual interface to the features of BaseX.
 
The [[GUI]] is the visual interface to the features of BaseX.
Line 55: Line 81:
 
explore your XML data.
 
explore your XML data.
  
It can be started as follows (get more information on all [[Command-Line Options#BaseX GUI|Startup Options]]):
+
It can be started as follows (get more information on all [[Command-Line Options#GUI|Startup Options]]):
  
 
* Double click on the {{Code|BaseX.jar}} file.
 
* Double click on the {{Code|BaseX.jar}} file.
Line 65: Line 91:
 
Note that the GUI does ''not'' interact with the client/server architecture.
 
Note that the GUI does ''not'' interact with the client/server architecture.
  
==Client/Server==
+
=Client/Server=
  
===Server===
+
==Server==
  
 
The [[Database Server]] comes into play if BaseX is to be used by
 
The [[Database Server]] comes into play if BaseX is to be used by
Line 75: Line 101:
 
By default, the server listens to the port {{Code|1984}}.
 
By default, the server listens to the port {{Code|1984}}.
 
There are several ways of starting and stopping the server
 
There are several ways of starting and stopping the server
(get more information on all [[Command-Line Options#BaseX Server|Startup Options]]):
+
(get more information on all [[Command-Line Options#Server|Startup Options]]):
  
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basexserver]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basexserver.bat]]}} scripts. Add the {{Code|stop}} keyword to gracefully shut down the server.
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basexserver]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basexserver.bat]]}} scripts. Add the {{Code|stop}} keyword to gracefully shut down the server.
 
* Execute the following command: {{Code|java -cp BaseX.jar org.basex.BaseXServer}}. Again, the {{Code|stop}} keyword will ensure a graceful shutdown.
 
* Execute the following command: {{Code|java -cp BaseX.jar org.basex.BaseXServer}}. Again, the {{Code|stop}} keyword will ensure a graceful shutdown.
* On ''Windows'': Double click on the '''BaseX Server''' icon, which will also start the [[#BaseX HTTP Server|HTTP Server]], or the '''BaseX Server (stop)''' icon.
+
* On ''Windows'': Double click on the '''BaseX Server''' icon, which will also start the [[#HTTP Server|HTTP Server]], or the '''BaseX Server (stop)''' icon.
  
 
Pressing {{Code|Ctrl+c}} will close all connections and databases and shut down the server process.
 
Pressing {{Code|Ctrl+c}} will close all connections and databases and shut down the server process.
  
===Client===
+
==Client==
  
 
The [[Database Server|BaseX Client]] interface can be used to send
 
The [[Database Server|BaseX Client]] interface can be used to send
Line 89: Line 115:
  
 
It can be started as follows
 
It can be started as follows
(get more information on all [[Command-Line Options#BaseX Client|Startup Options]]):
+
(get more information on all [[Command-Line Options#Client|Startup Options]]):
  
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basexclient]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basexclient.bat]]}} scripts.
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basex|basexclient]]}} or {{Code|[[Start Scripts#Windows: basex.bat|basexclient.bat]]}} scripts.
Line 100: Line 126:
 
The password should be changed with the {{Code|[[Commands#PASSWORD|PASSWORD]]}} command after the first login.<br/>
 
The password should be changed with the {{Code|[[Commands#PASSWORD|PASSWORD]]}} command after the first login.<br/>
  
We provide various [[Clients|BaseX Clients]], which allow you to communicate with BaseX from other programming lanaguges.
+
We provide additional clients in various [[Clients|programming languages]].
  
==HTTP Server==
+
=HTTP Server=
  
With the HTTP Server, BaseX can be used as [[Web Application]].
+
With the HTTP Server, BaseX can be used to build [[Web Application]]s.
 
It provides access to the [[REST]], [[RESTXQ]] and [[WebDAV]] services.
 
It provides access to the [[REST]], [[RESTXQ]] and [[WebDAV]] services.
 
An instance of the [http://jetty.codehaus.org/jetty/ Jetty Web Server] will be created,
 
An instance of the [http://jetty.codehaus.org/jetty/ Jetty Web Server] will be created,
Line 110: Line 136:
 
be started, which is accessible on port {{Code|1984}}.
 
be started, which is accessible on port {{Code|1984}}.
  
To run the HTTP Server, you need to [http://basex.org/products/download/ download] one of the full distributions of BaseX (exe, zip, war), as the JAR version does not include any additionally required libraries. It can then be started as follows
+
It can be started as follows (get more information on all [[Command-Line Options#HTTP Server|Startup Options]]):
(get more information on all [[Command-Line Options#BaseX HTTP Server|Startup Options]]):
 
  
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basexhttp|basexhttp]]}} or {{Code|[[Start Scripts#Windows: basexhttp.bat|basexhttp.bat]]}} scripts. Call the script with the {{Code|stop}} keyword to gracefully shut down the server.
 
* Run one of the {{Code|[[Start_Scripts#Linux.2FMac:_basexhttp|basexhttp]]}} or {{Code|[[Start Scripts#Windows: basexhttp.bat|basexhttp.bat]]}} scripts. Call the script with the {{Code|stop}} keyword to gracefully shut down the server.
Line 117: Line 142:
 
* BaseX can also be deployed as [[Web Application#Servlet Container|web servlet]].
 
* BaseX can also be deployed as [[Web Application#Servlet Container|web servlet]].
  
After that, you can open your browser and navigate to the start page http://localhost:8984.
+
In the first two cases, the command-line output will look similar to the following lines (the JSP warning message [http://stackoverflow.com/questions/3521654/missing-jsp-support-in-jetty-or-confusing-log-message can be ignored]):
 +
 
 +
<pre class="brush:xml">
 +
[main] INFO org.eclipse.jetty.server.Server - jetty-8.1.18.v20150929
 +
[main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
 +
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:8984
 +
HTTP Server was started (port: 8984).
 +
</pre>
 +
 
 +
You can adjust the Jetty logging level by adding the following properties to the start script:
 +
 
 +
<pre class="brush:xml">
 +
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -D{classref}.LEVEL=DEBUG
 +
</pre>
 +
 
 +
After that, you can e. g. open your browser and navigate to the RESTXQ start page http://localhost:8984.
 +
 
 +
==Database Administration==
 +
 
 +
The [[DBA]] is a web-based database administration interface. It allows you to create and administrate databases, evaluate queries in realtime, view log files, manage users, etc.
 +
 
 +
It can be accessed via http://localhost:8984/dba/.
  
 
=Changelog=
 
=Changelog=
Line 128: Line 174:
  
 
* Updated: BaseXJAXRX has been replaced with BaseXHTTP
 
* Updated: BaseXJAXRX has been replaced with BaseXHTTP
 
[[Category:Beginner]]
 

Revision as of 11:50, 30 July 2018

This article is part of the Getting Started Guide. It tells you how to get BaseX running.

Getting Started

BaseX is very light-weight. It can be run and used in various ways:

It can also be embedded as a library in your own application.

First of all, download BaseX from our homepage. The following distributions are available:

Distributions

Core Package

The Core Package is a small JAR file. It contains the database system, the XQuery processor and the graphical user interface. It does not require any additional libraries.

Full Distributions

The ZIP Package and the Windows Installer contain the BaseX core library and extra libraries for web applications and advanced features, Start Scripts, and some additional optional files.

After BaseX has been unzipped or installed, the following directories will be available:

  • bin/: Start scripts (Windows, Linux).
  • data/: Database directory. See Configuration for more details.
  • etc/: Example data: XML sample, catalog and DTD files.
  • lib/: Extra libraries (Jetty, Tagsoup, …).
  • lib/custom/: Directory, in which additional JAR files can be placed (such as the Saxon library).
  • repo/: Repository (the FunctX library is included as example).
  • src/: Directory for your XQuery scripts and other source data.
  • webapp/: Web Application directory: RESTXQ web application, REST scripts, DBA.

If BaseX is started via the start scripts or the Windows icons, all JAR files in the lib directory and its descendant directories will be added to the classpath.

If you work with the ZIP distribution, and if you want to make BaseX globally available, you can add the bin directory to your PATH environment variable.

Web Archive

The WAR Archive can be embedded in existing Java web servers.

Other Distributions

Various other distributions are available from the download page, most of which contain only the core package and, optionally, scripts for starting BaseX.

Requirements

BaseX is platform-independent and runs on any system that provides an implementation of the Java Runtime Environment (JRE):

  • Since Version 9 of BaseX, Java 8 is required.
  • Since Version 8, Java 7 is required.
  • Older versions are based on Java 6.

BaseX has been tested on several platforms, including Windows (2000, XP, Vista, 7), Max OS X (10.x), Linux (SuSE xxx, Debian, Ubuntu) and OpenBSD (4.x).

Concurrent Operations

If you want to perform parallel (concurrent) read and write operations on your databases, you must use the client/server architecture or deploy BaseX as web application. You can safely open a database in different JVMs (Java virtual machines) for read-only access, and you will not encounter any problems when reading from and writing to different databases, but update operations from different JVMs to the same database will be rejected or may even lead to corrupt databases.

For example, if you only read data, you can easily run several clients (standalone, GUI, database clients) at the same time. If you update your data, however, you shouldn’t use the GUI or a standalone instance at the same time.

More details on concurrency are found in the Transaction Management article.

Standalone

The Standalone Mode can be used to execute XQuery expressions or run database commands on command line. It can also be used both for scripting and batch processing your XML data. It can be started as follows (get more information on all Startup Options):

  • Run one of the basex or basex.bat scripts.
  • Execute the following command: java -cp BaseX.jar org.basex.BaseX
  • On Windows: Double click on the BaseX icon.

It is important to remember that the standalone mode does not interact with the Client/Server architecture.

Graphical User Interface

The GUI is the visual interface to the features of BaseX. It can be used to create new databases, perform queries or interactively explore your XML data.

It can be started as follows (get more information on all Startup Options):

  • Double click on the BaseX.jar file.
  • Run one of the basexgui or basexgui.bat scripts.
  • Execute the following command: java -cp BaseX.jar org.basex.BaseXGUI
  • On Windows: Double click on the BaseX GUI icon.
  • For Maven users: type in mvn exec:java in the main directory of the basex project.

Note that the GUI does not interact with the client/server architecture.

Client/Server

Server

The Database Server comes into play if BaseX is to be used by more than one user (client). It handles concurrent read and write transactions, provides user management and logs all user interactions.

By default, the server listens to the port 1984. There are several ways of starting and stopping the server (get more information on all Startup Options):

  • Run one of the basexserver or basexserver.bat scripts. Add the stop keyword to gracefully shut down the server.
  • Execute the following command: java -cp BaseX.jar org.basex.BaseXServer. Again, the stop keyword will ensure a graceful shutdown.
  • On Windows: Double click on the BaseX Server icon, which will also start the HTTP Server, or the BaseX Server (stop) icon.

Pressing Ctrl+c will close all connections and databases and shut down the server process.

Client

The BaseX Client interface can be used to send commands and queries to the server instance on command line.

It can be started as follows (get more information on all Startup Options):

  • Run one of the basexclient or basexclient.bat scripts.
  • Execute the following command: java -cp BaseX.jar org.basex.BaseXClient
  • On Windows: Double click on the BaseX Client icon.

The default admin user can be used to connect to the server:

  • Username: admin
  • Password: admin

The password should be changed with the PASSWORD command after the first login.

We provide additional clients in various programming languages.

HTTP Server

With the HTTP Server, BaseX can be used to build Web Applications. It provides access to the REST, RESTXQ and WebDAV services. An instance of the Jetty Web Server will be created, which by default listens to the port 8984. Additionally, the BaseX Server will be started, which is accessible on port 1984.

It can be started as follows (get more information on all Startup Options):

  • Run one of the basexhttp or basexhttp.bat scripts. Call the script with the stop keyword to gracefully shut down the server.
  • On Windows: Double click on the BaseX Server or BaseX Server (stop) icon.
  • BaseX can also be deployed as web servlet.

In the first two cases, the command-line output will look similar to the following lines (the JSP warning message can be ignored):

[main] INFO org.eclipse.jetty.server.Server - jetty-8.1.18.v20150929
[main] INFO org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:8984
HTTP Server was started (port: 8984).

You can adjust the Jetty logging level by adding the following properties to the start script:

-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -D{classref}.LEVEL=DEBUG

After that, you can e. g. open your browser and navigate to the RESTXQ start page http://localhost:8984.

Database Administration

The DBA is a web-based database administration interface. It allows you to create and administrate databases, evaluate queries in realtime, view log files, manage users, etc.

It can be accessed via http://localhost:8984/dba/.

Changelog

Version 8.0
  • Update: Switched to Java 7
Version 7.0
  • Updated: BaseXJAXRX has been replaced with BaseXHTTP