Difference between revisions of "Java Examples"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
The following Java code snippets demonstrate how easy it is to run database commands, create collections, perform queries, etc. via the BaseX API. Most examples are taken from our [https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples basex-examples] repository, in which you will find some more use cases. | The following Java code snippets demonstrate how easy it is to run database commands, create collections, perform queries, etc. via the BaseX API. Most examples are taken from our [https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples basex-examples] repository, in which you will find some more use cases. | ||
− | + | {{Mark|Since 7.2.1}}, BaseX uses Charles Foster’s generic [http://xqj.net/basex/ XQJ API], which fully utilized the client/server architecture of BaseX. | |
+ | Note that the {{Mono|XML:DB}} API can only be used in embedded mode. | ||
==Local Examples== | ==Local Examples== |
Revision as of 13:06, 26 April 2012
This page is part of the Developer Section. The following Java code snippets demonstrate how easy it is to run database commands, create collections, perform queries, etc. via the BaseX API. Most examples are taken from our basex-examples repository, in which you will find some more use cases.
Template:Mark, BaseX uses Charles Foster’s generic XQJ API, which fully utilized the client/server architecture of BaseX.
Note that the XML:DB
API can only be used in embedded mode.
Contents
Local Examples
- RunCommands.java
- creates and drops database and index instances, prints a list of all existing databases.
- WikiExample.java
- creates a database from an url (wiki instance), runs a query against it and drops the database.
- RunQueries.java
- shows three variants of running queries.
- CreateCollection.java
- creates and manages a collection.
- QueryCollection.java
- creates, runs queries against it and drops a collection.
Server Examples
- ServerCommands.java
- launches server-side commands using a client session.
- ServerAndLocal.java
- processes server results locally.
- ServerConcurrency.java
- runs concurrent queries.
- UserExample.java
- manages database users.
REST API Examples
- RESTGet.java
- presents the HTTP GET method.
- RESTPost.java
- presents the HTTP POST method.
- RESTPut.java
- presents the HTTP PUT method.
- RESTDelete.java
- presents the HTTP DELETE method.
XML:DB API Examples
- XMLDBCreate.java
- creates a collection using XML:DB.
- XMLDBQuery.java
- runs a query using XML:DB.
- XMLDBInsert.java
- inserts a document into a database using XML:DB.
XQJ API Examples
Since Version 7.2.1, BaseX uses Charles Foster’s generic XQJ API.