-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial: Run the console
Previous : Tutorial: Run the server - Next: Tutorial: Classes
To use the database let's start from the command line console by executing console.sh (or console.bat on Windows) in bin directory:
> cd bin
> ./console.sh
This is the welcome message:
OrientDB console v.1.3.0 www.orientechnologies.com
Type 'help' to display all the commands supported.
orientdb>
To connect to the server was launched before, you must run the connect command from the console by specifying the coordinates of the server, username and password. By default each database has the "admin" user with password "admin". To connect to the demo database of the local server use:
> connect remote:localhost/demo admin admin
Connecting to database [remote:localhost/demo] with user 'admin'...OK
Let's analyze the URL used: remote:localhost/demo. The first part is the protocol, remote in this case, and means to contact the server using the TCP/IP protocol. localhost is the host name or the IP address where the server resides, in this case is on the same machine of the console (client). demo is the name of the database that we want to connect.
Both the distributions come with a database in bundle:
- Classic Edition has the demo database as the result of all the test cases
- Graph Edition has the tinkerpop database as the Graph of the Grateful Dead's concerts.
If you've downloaded the Graph Edition replace "demo" with "tinkerpop". These two databases will be just fine as beginning to explore the characteristics of OrientDB till we will create a new one.
Type the "help" command to know all the available console commands:
orientdb> help
AVAILABLE COMMANDS:
* alter class <command-text> Alter a class in the database schema
* alter cluster <command-text> Alters a cluster in the current database. The cluster can be physical or memory
* alter database <command-text> Alter a database property
* alter property <command-text> Alter a class property in the database schema
* begin Begins a transaction. All the changes will remain local
* browse class <class-name> Browse all records of a class
* browse cluster <cluster-name> Browse all records of a cluster
* check database <options> Check database integrity
* classes Display all the configured classes
* cluster status Displays the status of the cluster nodes
* clusters Display all the configured clusters
* commit Commits transaction changes to the database
* compare databases <db1-url> <db2-url> <user-name> <user-password> Compare two databases
* config Return all the configuration values
* config get <config-name> Return the value of a configuration value
* config set <config-name> <config-value> Change the value of a configuration value
* connect <url> <user> <password> Connect to a database or a remote Server instance
* copy database <db-name> <db-user> <db-password> <server-name> <engine-name>Copy a database to a remote server
* create class <command-text> Create a class
* create cluster <cluster-name> <cluster-type> <data-segment> <location> <position>Create a new cluster in the current database. The cluster can be physical or memory
* create database <database-url> <user> <password> <storage-type> <db-type>Create a new database
* create datasegment <datasegment-name> <datasegment-location> Create a new data-segment in the current database.
* create edge <command-text> Create a new edge into the database
* create index <command-text> Create an index against a property
* create link <command-text> Create a link from a JOIN
* create property <command-text> Create a property
* create vertex <command-text> Create a new vertex into the database
* declare intent <Intent name> Declare an intent
* delete <command-text> Delete records from the database
* dictionary get <key> Loook up a record using the dictionary. If found, set it as the current record
* dictionary keys Display all keys in the database dictionary
* dictionary put <key> <record-id> Insert or modify an entry in the database dictionary. The entry is comprised of key=String, value=record-id
* dictionary remove <key> Remove the association in the dictionary
* disconnect Disconnect from the current database
* display raw record <rid> Display a record as raw bytes
* display record <number> Display current record attributes
* drop class <command-text> Remove a class from the schema
* drop cluster <cluster-name> Remove a cluster in the current database. The cluster can be physical or memory
* drop database Delete the current database
* drop database <database-url> <user> <password> Delete the specified database
* drop index <command-text> Remove an index
* drop property <command-text> Remove a property from a class
* explain <command-text> Explain how a command is executed profiling it
* export database <options> Export a database
* export record <format> <options> Export the current record in the requested format
* export schema <output-file> Export a database schema
* find references <command-text> Find all references the target record id @rid
* freeze database Freeze database and flush on the disk
* get <property-name> Return the value of a property
* grant <text> Grant privileges to a role
* import database <options> Import a database into the current one
* indexes Display all indexes
* info Display information about the database
* info class <class-name> Display the schema of a class
* insert <command-text> Insert a new record into the database
* js <text> Execute javascript commands in the console
* jss <text> Execute javascript commands against a remote server
* list databases List all the databases available on the connected server
* load record <record-id> Load a record in memory and set it as the current
* load record <record-id> <fetch-plan> Load a record in memory using passed fetch plan
* profiler <profiler command> Execute a command against the profiler
* properties Return all configured properties
* pwd Display the current path
* rebuild index <command-text> Rebuild an index if it is automatic
* release database Release database after freeze
* reload record <record-id> Reload a record and set it as the current one
* reload record <record-id> <fetch-plan> Reloads a record using passed fetch plan
* reload schema Reload the database schema
* replication align <db-name> <server-name> <options> Align two databases in different servers
* replication get conflicts <db-name> Gets the replication conflicts for a database against a remote server
* replication get journal <db-name> <server-name> Gets the replication journal for a database against a remote server
* replication reset journal <db-name> <server-name> Resets the replication journal for a database against a remote server
* revoke <text> Revoke privileges to a role
* rollback Rolls back transaction changes to the previous state
* select <query-text> Execute a query against the database and display the results
* set <property-name> <property-value> Change the value of a property
* show holes Shows the holes in current storage
* sleep Sleep X milliseconds
* traverse <query-text> Traverse records and display the results
* truncate class <text> Truncate the class content in the current database
* truncate cluster <text> Truncate the cluster content in the current database
* truncate record <text> Truncate a record deleting it at low level
* update <command-text> Update records in the database
* help Print this help
* exit Close the console
For more information look at Console page.
Previous : Tutorial: Run the server - Next: Tutorial: Classes