Difference between revisions of "Standard Mode"
m (→Example: moved comments inside the code)
|Line 17:||Line 17:|
Session session = new Session("localhost", 1984, "admin", "admin");
/Run the command in question and print the textual result:
print session.execute("info database");
/Close the session:
Revision as of 00:40, 13 December 2010
In the standard mode, a database command can be
sent to the server using 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:
- Create a new session instance with hostname, port, username and password.
- Call the
execute()function of the session with the database commands as argument.
- Receive the result of a successfully executed command. As an error occurs an exception is thrown.
- Continue using the client (back to 2.), or close the session.
// Create a session object: Session session = new Session("localhost", 1984, "admin", "admin"); //Run the command in question and print the textual result: print session.execute("info database"); //Close the session: session.close();