Standard Mode

From BaseX Documentation
Revision as of 12:55, 10 December 2010 by Michael (talk | contribs)
Jump to navigation Jump to search

In the standard mode, a database command can be sent to the server using the execute() function of the Session. This functions returns the whole result. With the info() function, you can request some information on your executed process. If an error occurs, an exception with the error message will be thrown.


The standard execution works as follows:

  1. Create a new session instance with hostname, port, username and password.
  2. Call the execute() function of the session with the <a href="commands">database command</a> as argument.
  3. Receive the result of a successfully executed command. As an error occurs an exception is thrown.
  4. Continue using the client (back to 2.), or close the session.


  1. Create a session object:
    Session session = new Session("localhost", 1984, "admin", "admin")
  2. Run the command in question and print the textual result:
    print session.execute("info database")
  3. Close the session: