Difference between revisions of "Database Server"

From BaseX Documentation
Jump to navigation Jump to search
(17 intermediate revisions by 3 users not shown)
Line 4: Line 4:
  
 
==Server==
 
==Server==
 +
 +
{{Announce|With Version 10, the default admin password has been removed.}}
  
 
The database server handles concurrent [[Transaction_Management|read and write transactions]], [[User Management|manages user permissions]] and [[Logging|logs user interactions]]. It can be started as follows:
 
The database server handles concurrent [[Transaction_Management|read and write transactions]], [[User Management|manages user permissions]] and [[Logging|logs user interactions]]. It can be started as follows:
  
* 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|basexserver}} or {{Code|basexserver.bat}} scripts. Use {{Code|basexserverstop}} or {{Code|basexserverstop.bat}} 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.
 
 
* If you have installed BaseX on ''Windows'', click on the '''BaseX HTTP Server (Start)''' icon, which will start both the HTTP Server used for [[#Web Application|Web Applications]] and the database server. With '''BaseX HTTP Server (Stop)''', you can shut down the server process.
 
* If you have installed BaseX on ''Windows'', click on the '''BaseX HTTP Server (Start)''' icon, which will start both the HTTP Server used for [[#Web Application|Web Applications]] and the database server. With '''BaseX HTTP Server (Stop)''', you can shut down the server process.
  
By default, the server listens to the port {{Code|1984}}. Various [[Command-Line_Options#Server|command-line options]] are available to simplify batch processing. The [[Start_Scripts|start script]] can be adjusted for individual purposes (e.g. if the default memory limit is too restrictive).
+
Unless you have already chosen an admin password yet (e.g., via the Windows installer or a previous installation), you can do so by invoking the {{Command|PASSWORD}} command on your terminal:
 +
 
 +
<pre>
 +
basexserver -c PASSWORD
 +
BaseX [Server]
 +
Server was started (port: 1984).
 +
Password: _
 +
</pre>
 +
 
 +
By default, the server listens to the port {{Code|1984}}. Pressing {{Code|Ctrl+c}} will close all connections and databases and gracefully shut down the server process.
 +
 
 +
Various [[Command-Line_Options#Server|command-line options]] are available to simplify batch processing. The [[Start_Scripts|start script]] can be adjusted for individual purposes (e.g. if the default memory limit is too restrictive).
  
 
==Client==
 
==Client==
Line 17: Line 29:
 
Database clients are started similarly:
 
Database clients are started similarly:
  
* 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|basexclient}} or {{Code|basexclient.bat}} scripts.
 
* Execute the following command: {{Code|java -cp BaseX.jar org.basex.BaseXClient}}
 
* Execute the following command: {{Code|java -cp BaseX.jar org.basex.BaseXClient}}
 
* If you have installed BaseX on ''Windows'', click on the '''BaseX Client''' icon.
 
* If you have installed BaseX on ''Windows'', click on the '''BaseX Client''' icon.
  
At startup, you need to enter your credentials. The initial passwort of the {{Code|admin}} user is {{Code|admin}}; it can be changed with the {{Code|[[Commands#PASSWORD|PASSWORD]]}} command.
+
At startup, you need to enter your credentials.
  
 
For further details, have a look at the [[Command-Line_Options#Client|command-line options]] and the [[Start_Scripts|start script]].
 
For further details, have a look at the [[Command-Line_Options#Client|command-line options]] and the [[Start_Scripts|start script]].
Line 32: Line 44:
 
   
 
   
 
<pre>
 
<pre>
basexclient -V -Uadmin -Padmin -c "CREATE DB input <example/>; XQUERY /"
+
basexclient -V -Uadmin -P... -c "CREATE DB input <example/>; XQUERY /"
  
 
Database 'input' created in 13.85 ms.
 
Database 'input' created in 13.85 ms.
Line 51: Line 63:
 
Write Locking: none
 
Write Locking: none
  
Query "user" executed in 0.41 ms.</pre>
+
Query "user" executed in 0.41 ms.
 +
</pre>
  
 
=Language Bindings=
 
=Language Bindings=
  
 
If you want to communicate with the database server programmatically, we provide clients for various [[Clients|programming languages]].
 
If you want to communicate with the database server programmatically, we provide clients for various [[Clients|programming languages]].
 +
 +
=Changelog=
 +
 +
;Version 10.0
 +
* Updated: The default admin password has been removed.

Revision as of 14:00, 25 July 2022

This article belongs to the Getting Started Guide. It tells you how to run BaseX in client-server mode from command-line.

Startup

Server

With Version 10, the default admin password has been removed.

The database server handles concurrent read and write transactions, manages user permissions and logs user interactions. It can be started as follows:

  • Run one of the basexserver or basexserver.bat scripts. Use basexserverstop or basexserverstop.bat to gracefully shut down the server.
  • If you have installed BaseX on Windows, click on the BaseX HTTP Server (Start) icon, which will start both the HTTP Server used for Web Applications and the database server. With BaseX HTTP Server (Stop), you can shut down the server process.

Unless you have already chosen an admin password yet (e.g., via the Windows installer or a previous installation), you can do so by invoking the PASSWORD command on your terminal:

basexserver -c PASSWORD
BaseX [Server]
Server was started (port: 1984).
Password: _

By default, the server listens to the port 1984. Pressing Ctrl+c will close all connections and databases and gracefully shut down the server process.

Various command-line options are available to simplify batch processing. The start script can be adjusted for individual purposes (e.g. if the default memory limit is too restrictive).

Client

Database clients are started similarly:

  • Run one of the basexclient or basexclient.bat scripts.
  • Execute the following command: java -cp BaseX.jar org.basex.BaseXClient
  • If you have installed BaseX on Windows, click on the BaseX Client icon.

At startup, you need to enter your credentials.

For further details, have a look at the command-line options and the start script.

Introduction

The BaseX command-line client provides similar features to the standalone client. The major difference is that all commands will be executed by the BaseX server instance. As a consequence, paths/URIs to resources need to be resolvable by the server (file contents will not be transfered to the server).

Username and password can also be specified as command-line option. To evaluate commands without entering the console mode, you can use the -c option on the command line:

basexclient -V -Uadmin -P... -c "CREATE DB input <example/>; XQUERY /"

Database 'input' created in 13.85 ms.
<example/>
Query:
/

Parsing: 0.18 ms
Compiling: 0.04 ms
Evaluating: 0.12 ms
Printing: 0.07 ms
Total Time: 0.41 ms

Hit(s): 1 Item
Updated: 0 Items
Printed: 10 Bytes
Read Locking: local [input]
Write Locking: none

Query "user" executed in 0.41 ms.

Language Bindings

If you want to communicate with the database server programmatically, we provide clients for various programming languages.

Changelog

Version 10.0
  • Updated: The default admin password has been removed.