Rocto

Rocto is the Remote Octo server. It is an implementation of the Postgres server, and receives SQL queries from any clients that can communicate with Postgres over the network. These queries are passed to Octo, which interacts with the database and passes results back through Rocto to the clients.

Connecting to SQuirreLSQL

SQuirreL SQL is an open-source Java SQL Client program for any JDBC compliant database.

To connect Rocto to SQuirreL SQL:

  • Add a PostgreSQL JAR file as a driver to SQuirreL SQL.

  • Configure the PostgreSQL driver to use the provided JAR file. The URL format for PostgreSQL in SQuirreL SQL is jdbc:postgresql:[<//host>[:<5432>/]]<database>.

_images/driver.png

Click “Add” and put in the path to the JAR file

Put in the path to your JAR file (e.g. ~/user/postgresql-42.2.6-SNAPSHOT.jar) in the dialog box that pops up after clicking “Add” on the interface above.

  • Create an alias for your Rocto server, including the server IP address and port number. These can be configured for Rocto in the config file. For example,

    jdbc:postgresql://localhost:1337/example
    

Rocto requires the creation of a user name and password. Follow the directions given in the Octo Administration Guide to add a new user.

Use the user name and password created in the previous step with the newly created connection alias.

_images/alias.png
  • Rocto does not currently support SSL, so make sure to turn SSL off in the Properties menu when configuring an alias. (Click on Properties and then disable sslmode.)

_images/properties.png
  • Connect to Rocto: Execute rocto in your terminal and press the “Connect” button in SQuirreL SQL. Now you can execute SQL queries.

For example:

Suppose there is a table “names” with records in it:

CREATE TABLE names (id INTEGER PRIMARY KEY, firstName VARCHAR, lastName VARCHAR);

A simple query in SQuirreL SQL could be:

SELECT * FROM names;
_images/query.png

Result after the query

To terminate the Rocto instance, you may use CTRL+C. Note that the rocto instance may not exit immediately upon sending CTRL+C if there are still active client connections. In that case, rocto will gracefully exit once all client connections are closed.

Command Line Options

Note

Mandatory arguments for long options are also mandatory for short options.

  1. -a, \-\-allowschemachanges

    Note

    The -a/--allowschemachanges option is off by default and must be explicitly enabled since normal users will not need to change the schema. When using this option, implement security measures appropriate to the environment, e.g. network controls to restrict access to the listening TCP port to a specific host or subnet.

    Allows Rocto to make changes to the schema (CREATE TABLE and DROP TABLE).

  2. -c, \-\-config-file=<filepath>

    Note

    Octo looks for configuration files in default locations, e.g. $ydb_dist/plugin/octo/octo.conf. If a configuration file is specified on the command line, this will override any configuration specified in files from the default locations.

    Use specified configuration file instead of the default.

  3. -h, \-\-help

    Display the help message and exit.

  4. -p, \-\-port=<number>

    Listen on the specified port.

  5. -v, \-\-verbose=<number>

    Specify amount of information to output when running commands specifying a numeric value from 0-5 or adding additional ‘v’ characters.

  6. -r, \-\-version

    Display version information and exit.

  7. -r, \-\-release

    Display release information and exit.