Difference between revisions of "Java Examples"
Jump to navigation
Jump to search
m (Text replace - "='coral'" to "='olivedrab'") |
m (Text replace - "='olivedrab'" to "='seagreen'") |
||
Line 34: | Line 34: | ||
==[[JAX-RX API]] Examples== | ==[[JAX-RX API]] Examples== | ||
− | Deprecated from <font color=' | + | Deprecated from <font color='seagreen'>Version 6.8</font> of BaseX: |
;[[JaxRxGET]] | ;[[JaxRxGET]] | ||
Line 53: | Line 53: | ||
==[[REST API]] Examples== | ==[[REST API]] Examples== | ||
− | Introduced with <font color=' | + | Introduced with <font color='seagreen'>Version 6.8</font> of BaseX: |
;[[RESTGet]] | ;[[RESTGet]] |
Revision as of 23:48, 12 September 2011
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.
Note that we recommend everyone to use our own APIs, as they offer better performance and are better supported by our core team. The use of the XML:DB
and XQJ
APIs is discouraged: as these APIs do not utilize the client/server architecture of BaseX, their use may lead to conflicting database access operations.
Contents
Local Examples
- RunCommands
- creates and drops database and index instances, prints a list of all existing databases.
- WikiExample
- creates a database from an url (wiki instance), runs a query against it and drops the database.
- RunQueries
- shows three variants of running queries.
- CreateCollection
- creates and manages a collection.
- QueryCollection
- creates, runs queries against it and drops a collection.
Server Examples
- ServerCommands
- launches server-side commands using a client session.
- ServerAndLocal
- processes server results locally.
- ServerConcurrency
- runs concurrent queries.
- UserExample
- manages database users.
JAX-RX API Examples
Deprecated from Version 6.8 of BaseX:
- JaxRxGET
- presents the HTTP GET method.
- JaxRxPOSTAdd
- presents the add function of the HTTP POST method.
- JaxRxPOSTQuery
- presents the query function of the HTTP POST method.
- JaxRxPUT
- presents the HTTP PUT method.
- JaxRxDELETE
- presents the HTTP DELETE method.
REST API Examples
Introduced with Version 6.8 of BaseX:
- RESTGet
- presents the HTTP GET method.
- RESTPostAdd
- presents the add function of the HTTP POST method.
- RESTPostQuery
- presents the query function of the HTTP POST method.
- RESTPut
- presents the HTTP PUT method.
- RESTDelete
- presents the HTTP DELETE method.
XML:DB API Examples
- XMLDBCreate
- creates a collection using XML:DB.
- XMLDBQuery
- runs a query using XML:DB.
- XMLDBInsert
- inserts a document into a database using XML:DB.
XQJ API Example
- XQJQuery
- runs a query using XQJ.