OrientDB – Indexes ”; Previous Next Index is a pointer which points to a location of data in the database. Indexing is a concept used to quickly locate the data without having to search every record in a database. OrientDB supports four index algorithms and several types within each. The four types of index are − SB-Tree Index It provides a good mix of features available from other index types. Better to use this for general utility. It is durable, transactional and supports range queries. It is default index type. The different type plugins that support this algorithm are − UNIQUE − These indexes do not allow duplicate keys. For composite indexes, this refers to the uniqueness of the composite keys. NOTUNIQUE − These indexes allow duplicate keys. FULLTEXT − These indexes are based on any single word of text. You can use them in queries through the CONTAINSTEXT operator. DICTIONARY − These indexes are similar to those that use UNIQUE, but in the case of duplicate keys, they replace the existing record with the new record. Hash Index It performs faster and is very light in disk usage. It is durable, transactional, but does not support range queries. It works like HASHMAP, which makes it faster on punctual lookups and it consumes less resources than other index types. The different type plugins that support this algorithm are − UNIQUE_HASH_INDEX − These indexes do not allow duplicate keys. For composite indexes, this refers to the uniqueness of the composite keys. NOTUNIQUE_HASH_INDEX − These indexes allow duplicate keys. FULLTEXT_HASH_INDEX − These indexes are based on any single word of text. You can use them in queries through the CONTAINSTEXT operator. DICTIONARY_HASH_INDEX − These indexes are similar to those that use UNIQUE_HASH_INDEX, but in cases of duplicate keys, they replace the existing record with the new record. Lucene Full Text Index It provides good full-text indexes, but cannot be used to index other types. It is durable, transactional, and supports range queries. Lucene Spatial Index It provides good spatial indexes, but cannot be used to index other types. It is durable, transactional, and supports range queries. Creating Indexes Create index is a command to create an index on a particular schema. The following statement is the basic syntax to create an index. CREATE INDEX <name> [ON <class-name> (prop-names)] <type> [<key-type>] [METADATA {<metadata>}] Following are the details about the options in the above syntax. <name> − Defines the logical name for the index. You can also use the <class.property> notation to create an automatic index bound to a schema property. <class> uses the class of the schema and <property> uses the property created in the class. <class-name> − Provides the name of the class that you are creating the automatic index to index. This class must exist in the database. <prop-names> − Provides the list of properties, which you want the automatic index to index. These properties must already exist in schema. <type> − Provides the algorithm and type of index that you want to create. <key-type> − Provides the optional key type with automatic indexes. <metadata> − Provides the JSON representation. Example Try the following query to create automatic index bound to the property ‘ID’ of the user sales_user. orientdb> CREATE INDEX indexforID ON sales_user (id) UNIQUE If the above query is executed successfully, you will get the following output. Creating index… Index created successfully with 4 entries in 0.021000 sec(s) Querying Indexes You can use select query to get the records in the index. Try the following query to retrieve the keys of index named ‘indexforId’. SELECT FROM INDEX:indexforId If the above query is executed successfully, you will get the following output. —-+——+—-+—– # |@CLASS|key |rid —-+——+—-+—– 0 |null |1 |#11:7 1 |null |2 |#11:6 2 |null |3 |#11:5 3 |null |4 |#11:8 —-+——+—-+—– Drop Indexes If you want to drop a particular index, you can use this command. This operation does not remove linked records. The following statement is the basic syntax to drop an index. DROP INDEX <name> Where <name> provides the name of the index you want to drop. Try the following query to drop an index named ‘ID’ of user sales_user. DROP INDEX sales_users.Id If the above query is executed successfully, you will get the following output. Index dropped successfully Print Page Previous Next Advertisements ”;
Category: orientdb
OrientDB – Logging
OrientDB – Logging ”; Previous Next OrientDB uses the Java Logging framework bundled with Java Virtual Machine. OrientDB”s default log format is managed by OLogFormatter class. The following statement is the basic syntax of logging command. <date> <level> <message> [<requester>] Following are the details about the options in the above syntax. <date> − It is the log date in the following format: yyyy-MM-dd HH:mm:ss:SSS. <level> − It is the logging level as 5 chars output. <message> − It is the text of log, it can be of any size. [<class>] − It is the Java class that is logged (optional). Supported levels are those contained in the JRE class java.util.logging.Level. They are − SEVERE (highest value) WARNING INFO CONFIG FINE FINER FINEST (lowest value) By default, two loggers are installed − Console, as the output of the shell/command prompt that starts the application/server. Can be changed by setting the variable ‘log.console.level’. File, as the output to the log files. Can be changed by setting the ‘log.file.level’. Configure Logging The logging strategies and policies can be configured using a file following the Java. syntax − Java Logging configuration. Example Copy the following content from orientdb-server-log.properties file and put it in the $ORIENTDB_HOME/config file. # Specify the handlers to create in the root logger # (all loggers are children of the root logger) # The following creates two handlers handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler # Set the default logging level for the root logger .level = ALL # Set the default logging level for new ConsoleHandler instances java.util.logging.ConsoleHandler.level = INFO # Set the default formatter for new ConsoleHandler instances java.util.logging.ConsoleHandler.formatter = com.orientechnologies.common.log.OLogFormatter # Set the default logging level for new FileHandler instances java.util.logging.FileHandler.level = INFO # Naming style for the output file java.util.logging.FileHandler.pattern =../log/orient-server.log # Set the default formatter for new FileHandler instances java.util.logging.FileHandler.formatter = com.orientechnologies.common.log.OLogFormatter # Limiting size of output file in bytes: java.util.logging.FileHandler.limit = 10000000 # Number of output files to cycle through, by appending an # integer to the base file name: java.util.logging.FileHandler.count = 10 To tell the JVM where the properties file is placed, you need to set the “java.util.logging.config.file” system property to it. For example, use the following command − $ java -Djava.util.logging.config.file=mylog.properties … Set the logging level To change the logging level without modifying the logging configuration, just set the “log.console.level” and “log.file.level” system variables to the requested levels. Logging at Startup Following are the procedures to set logging at startup level in different ways. In the Server Configuration Open the file orientdb-server-config.xml and add or update these lines at the end of the file inside the <properties> section − <entry value = “fine” name = “log.console.level” /> <entry value = “fine” name = “log.file.level” /> In Server.sh (or .bat) Script Set the system property “log.console.level” and “log.file.level” to the levels you want using the -D parameter of java. $ java -Dlog.console.level = FINE … Logging at Run-time Following are the procedures to set logging at startup level in different ways. By Using Java Code The system variable can be set at startup using the System.setProperty() API. The following code snippet is the syntax to set logging level using Java code. public void main(String[] args){ System.setProperty(“log.console.level”, “FINE”); … } On Remote Server Execute a HTTP POST against the URL: /server/log.<type>/<level>, where − <type> can be “console” or “file” <level> is one of the supported levels Example The following example uses cURL to execute a HTTP POST command against OrientDB Server. Server”s “root” user and password were used, replace with your own password. Enable the finest tracing level to console − curl -u root:root -X POST http://localhost:2480/server/log.console/FINEST Enable the finest tracing level to file − curl -u root:root -X POST http://localhost:2480/server/log.file/FINEST Print Page Previous Next Advertisements ”;
OrientDB – Studio
OrientDB – Studio ”; Previous Next OrientDB provides a web UI to carry out database operations through GUI. This chapter explains the different options available in OrientDB. Studio Homepage Studio is a web interface for the administration of OrientDB that comes in bundle with the OrientDB distribution. First, you need to start the OrientDB server using the following command. $ server.sh If you run OrientDB in your machine, the web interface can be accessed via the URL − http://localhost:2480 If the command is executed successfully, following will be the output on screen. Connect to an Existing Database To login, select a database from the databases list and use any database user. By default (username/password) reader/reader can read records from the database, writer/writer can read, create, update and delete records, while admin/admin has all rights. Drop an Existing Database Select a database from the databases list and click the trash icon. Studio will open a confirmation popup where you have to insert the Server User and Server Password. Then click the “Drop database” button. You can find the server credentials in the $ORIENTDB_HOME/config/orientdb-server-config.xml file. <users> <user name = “root” password = “pwd” resources = “*” /> </users> Create a New Database To create a new database, click the “New DB” button from the homepage. Following information is needed to create a new database − Database name Database type (Document/Graph) Storage type (plocal/memory) Server user Server password You can find the server credentials in the $ORIENTDB_HOME/config/orientdbserver-config.xml file. <users> <user name = “root” password = “pwd” resources = “*” /> </users> Once created, Studio will automatically login to the new database. Execute a Query Studio supports auto recognition of the language you”re using between those supported: SQL and Gremlin. While writing, use the auto-complete feature by pressing Ctrl + Space. The following shortcuts are available in the query editor − Ctrl + Return − To execute the query or just click the Run button. Ctrl/Cmd + Z − To undo changes. Ctrl/Cmd + Shift + Z − To redo changes. Ctrl/Cmd + F − To search in the editor. Ctrl/Cmd + / − To toggle a comment. The following screenshot shows how to execute a query. By clicking any @rid value in the result-set, you will go into document edit mode if the record is a Document, otherwise you will go into vertex edit. You can bookmark your queries by clicking the star icon in the results-set or in the editor. To browse bookmarked queries, click the Bookmarks button. Studio will open the bookmarks list on the left, where you can edit/delete or rerun queries. Studio saves the executed queries in the Local Storage of the browser. In the query settings, you can configure how many queries studio will keep in history. You can also search a previously executed query, delete all the queries from the history, or delete a single query. Edit Vertex To edit the vertex of the graph, go to the Graph section. Then run the following query. Select From Customer On successfully running the query, following be the output screenshot. Select the particular vertex in the graph canvas to edit. Select the edit symbol on the particular vertex. You will get the following screen which contains the options to edit the vertex. Schema Manager OrientDB can work in schema-less mode, schema mode or a mix of both. Here we”ll discuss the schema mode. Click on the Schema section on the top of web UI. You will get the following screenshot. Create a New Class To create a new Class, just click the New Class button. Following screenshot will appear. You will have to provide the following information as shown in the screenshot to create the new class. View All Indexes When you want to have an overview of all indexes created in your database, just click he all indexes button in the Schema UI. This will provide a quick access to some information about indexes (name, type, properties, etc.) and you can drop or rebuild them from here. Edit Class Click on any class on the schema section, you will get the following screenshot. While editing a class, you can add a property or add a new index. Add a Property Click the New Property button to add property. You will get the following screenshot. You have to provide the following details as shown in the screenshot to add property. Add an Index Click the New Index button. You will get the following screenshot. You have to provide the following details as shown in the screenshot to add an index. Graph Editor Click the graph section. Not only can you visualize your data in a graph style but you can also interact with the graph and modify it. To populate the graph area, type a query in the query editor or use the functionality Send To Graph from the Browse UI. Add Vertices To add a new Vertex in your Graph Database and in the Graph Canvas area, you have to press the button Add Vertex. This operation is done in two steps. In the first step, you have to choose the class for the new Vertex and then click Next. In the second step, you have to insert the field values of the new vertex. You can also add custom fields as OrientDB supports schema-less mode. To make the new vertex persistent, click ‘Save changes’ and the vertex will be saved into the database and added to the canvas area. Delete Vertices Open the circular menu by clicking on the Vertex that you want to delete. Open the submenu by hovering the mouse to the menu entry more (…) and then click the trash icon. Remove Vertices from Canvas Open the circular menu, open the sub-menu by hovering the mouse to the menu entry more (…) and then click the eraser icon. Inspect Vertices If you want to take a quick look to the Vertex property, click to the eye icon. Security Studio 2.0
OrientDB – Security
OrientDB – Security ”; Previous Next Like RDBMS, OrientDB also provides security based on well-known concepts, users, and roles. Each database has its own users and each user has one or more roles. Roles are the combination of working modes and set of permissions. Users By default OrientDB maintains three different users for all database in the server − Admin − This user has access to all functions on the database without limitation. Reader − This user is a read-only user. The reader can query any records in the database, but can”t modify or delete them. It has no access to internal information, such as the users and roles themselves. Writer − This user is the same as the user reader, but it can also create, update, and delete records. Working with Users When you are connected to a database, you can query the current users on the database by using SELECT queries on the OUser class. orientdb> SELECT RID, name, status FROM OUser If the above query is executed successfully, you will get the following output. —+——–+——–+——– # | @CLASS | name | status —+——–+——–+——– 0 | null | admin | ACTIVE 1 | null | reader | ACTIVE 2 | null | writer | ACTIVE —+——–+——–+——– 3 item(s) found. Query executed in 0.005 sec(s). Creating a New User To create a new user, use the INSERT command. Remember, in doing so, you must set the status to ACTIVE and give it a valid role. orientdb> INSERT INTO OUser SET name = ”jay”, password = ”JaY”, status = ”ACTIVE”, roles = (SELECT FROM ORole WHERE name = ”reader”) Updating Users You can change the name for the user with the UPDATE statement. orientdb> UPDATE OUser SET name = ”jay” WHERE name = ”reader” In the same way, you can also change the password for the user. orientdb> UPDATE OUser SET password = ”hello” WHERE name = ”reader” OrientDB saves the password in a hash format. The trigger OUserTrigger encrypts the password transparently before it saves the record. Disabling Users To disable a user, use UPDATE to switch its status from ACTIVE to SUSPENDED. For instance, if you want to disable all users except for admin, use the following command − orientdb> UPDATE OUser SET status = ”SUSPENDED” WHERE name <> ”admin” Roles A role determines what operations a user can perform against a resource. Mainly, this decision depends on the working mode and the rules. The rules themselves work differently, depending on the working mode. Working with Roles When you are connected to a database, you can query the current roles on the database using SELECT queries on the ORole class. orientdb> SELECT RID, mode, name, rules FROM ORole If the above query is executed successfully, you will get the following output. –+——+—-+——–+——————————————————- # |@CLASS|mode| name | rules –+——+—-+——–+——————————————————- 0 | null | 1 | admin | {database.bypassRestricted = 15} 1 | null | 0 | reader | {database.cluster.internal = 2, database.cluster.orole = 0… 2 | null | 0 | writer | {database.cluster.internal = 2, database.cluster.orole = 0… –+——+—-+——–+——————————————————- 3 item(s) found. Query executed in 0.002 sec(s). Creating New Roles To create a new role, use the INSERT statement. orientdb> INSERT INTO ORole SET name = ”developer”, mode = 0 Working with Modes Where rules determine what users belonging to certain roles can do on the databases, working modes determine how OrientDB interprets these rules. There are two types of working modes, designated by 1 and 0. Allow All But (Rules) − By default it is the super user mode. Specify exceptions to this using the rules. If OrientDB finds no rules for a requested resource, then it allows the user to execute the operation. Use this mode mainly for power users and administrators. The default role admin uses this mode by default and has no exception rules. It is written as 1 in the database. Deny All But (Rules) − By default this mode allows nothing. Specify exceptions to this using the rules. If OrientDB finds rules for a requested resource, then it allows the user to execute the operation. Use this mode as the default for all classic users. The default roles, reader and writer, use this mode. It is written as 0 in the database. Print Page Previous Next Advertisements ”;
OrientDB – List Database
OrientDB – List Database ”; Previous Next This chapter explains how to get the list of all databases in an instance from the OrientDB command line. The following statement is the basic syntax of the info command. LIST DATABASES Note − You can use this command only after connecting to a local or remote server. Example Before retrieving the list of databases, we have to connect to the localhost server through the remote server. It is required to remind that the username and password for connecting to the localhost instance is guest and guest respectively, which is configured in the orintdb/config/orientdb-server-config.xml file. You can use the following command to connect to the localhost database server instance. orientdb> connect remote:localhost guest It will ask the password. As per the config file password for guest is also guest. If it is successfully connected, you will get the following output. Connecting to remote Server instance [remote:localhost] with user ”guest”…OK orientdb {server = remote:localhost/}> After connecting to the localhost database server you can use the following command to list the databases. orientdb {server = remote:localhost/}> list databases If it is successfully executed, you will get the following output − Found 6 databases: * demo (plocal) * s2 (plocal) * s1 (plocal) * GratefulDeadConcerts (plocal) * s3 (plocal) * sample (plocal) orientdb {server = remote:localhost/}> Print Page Previous Next Advertisements ”;
OrientDB – Restore Database
OrientDB – Restore Database ”; Previous Next As like RDBMS, OrientDB also supports restoring operation. Only from the console mode, you can execute this operation successfully. The following statement is the basic syntax for restoring operation. orientdb> RESTORE DATABSE <url of the backup zip file> Example You have to perform this operation only from the console mode. Therefore, first you have to start the OrientDB console using the following OrientDB command. $ orientdb Then, connect to the respective database to restore the backup. You can use the following command to connect to the database named demo. orientdb> CONNECT PLOCAL:/opt/orientdb/databases/demo admin admin After successful connection, you can use the following command to restore the backup from ‘backup-demo.zip’ file. Before executing, make sure the backup-demo.zip file is placed in the current directory. Orientdb {db = demo}> RESTORE DATABASE backup-demo.zip If this command is executed successfully, you will get some success notifications along with the following message. Database restored in 0.26 seconds Print Page Previous Next Advertisements ”;
OrientDB – Basic Concepts
OrientDB – Basic Concepts ”; Previous Next The main feature of OrientDB is to support multi-model objects, i.e. it supports different models like Document, Graph, Key/Value and Real Object. It contains a separate API to support all these four models. Document Model The terminology Document model belongs to NoSQL database. It means the data is stored in the Documents and the group of Documents are called as Collection. Technically, document means a set of key/value pairs or also referred to as fields or properties. OrientDB uses the concepts such as classes, clusters, and link for storing, grouping, and analyzing the documents. The following table illustrates the comparison between relational model, document model, and OrientDB document model − Relational Model Document Model OrientDB Document Model Table Collection Class or Cluster Row Document Document Column Key/value pair Document field Relationship Not available Link Graph Model A graph data structure is a data model that can store data in the form of Vertices (Nodes) interconnected by Edges (Arcs). The idea of OrientDB graph database came from property graph. The vertex and edge are the main artifacts of the Graph model. They contain the properties, which can make these appear similar to documents. The following table shows a comparison between graph model, relational data model, and OrientDB graph model. Relational Model Graph Model OrientDB Graph Model Table Vertex and Edge Class Class that extends “V” (for Vertex) and “E” (for Edges) Row Vertex Vertex Column Vertex and Edge property Vertex and Edge property Relationship Edge Edge The Key/Value Model The Key/Value model means that data can be stored in the form of key/value pair where the values can be of simple and complex types. It can support documents and graph elements as values. The following table illustrates the comparison between relational model, key/value model, and OrientDB key/value model. Relational Model Key/Value Model OrientDB Key/Value Model Table Bucket Class or Cluster Row Key/Value pair Document Column Not available Document field or Vertex/Edge property Relationship Not available Link The Object Model This model has been inherited by Object Oriented programming and supports Inheritance between types (sub-types extends the super-types), Polymorphism when you refer to a base class and Direct binding from/to Objects used in programming languages. The following table illustrates the comparison between relational model, Object model, and OrientDB Object model. Relational Model Object Model OrientDB Object Model Table Class Class or Cluster Row Object Document or Vertex Column Object property Document field or Vertex/Edge property Relationship Pointer Link Before go ahead in detail, it is better to know the basic terminology associated with OrientDB. Following are some of the important terminologies. Record The smallest unit that you can load from and store in the database. Records can be stored in four types. Document Record Bytes Vertex Edge Record ID When OrientDB generates a record, the database server automatically assigns a unit identifier to the record, called RecordID (RID). The RID looks like #<cluster>:<position>. <cluster> means cluster identification number and the <position> means absolute position of the record in the cluster. Documents The Document is the most flexible record type available in OrientDB. Documents are softly typed and are defined by schema classes with defined constraint, but you can also insert the document without any schema, i.e. it supports schema-less mode too. Documents can be easily handled by export and import in JSON format. For example, take a look at the following JSON sample document. It defines the document details. { “id” : “1201”, “name” : “Jay”, “job” : “Developer”, “creations” : [ { “name” : “Amiga”, “company” : “Commodore Inc.” }, { “name” : “Amiga 500”, “company” : “Commodore Inc.” } ] } RecordBytes Record Type is the same as BLOB type in RDBMS. OrientDB can load and store document Record type along with binary data. Vertex OrientDB database is not only a Document database but also a Graph database. The new concepts such as Vertex and Edge are used to store the data in the form of graph. In graph databases, the most basic unit of data is node, which in OrientDB is called a vertex. The Vertex stores information for the database. Edge There is a separate record type called the Edge that connects one vertex to another. Edges are bidirectional and can only connect two vertices. There are two types of edges in OrientDB, one is regular and another one lightweight. Class The class is a type of data model and the concept drawn from the Object-oriented programming paradigm. Based on the traditional document database model, data is stored in the form of collection, while in the Relational database model data is stored in tables. OrientDB follows the Document API along with OPPS paradigm. As a concept, the class in OrientDB has the closest relationship with the table in relational databases, but (unlike tables) classes can be schema-less, schema-full or mixed. Classes can inherit from other classes, creating trees of classes. Each class has its own cluster or clusters, (created by default, if none are defined). Cluster Cluster is an important concept which is used to store records, documents, or vertices. In simple words, Cluster is a place where a group of records are stored. By default, OrientDB will create one cluster per class. All the records of a class are stored in the same cluster having the same name as the class. You can create up to 32,767(2^15-1) clusters in a database. The CREATE class is a command used to create a cluster with specific name. Once the cluster is created you can use the cluster to save records by specifying the name during the creation of any data model. Relationships OrientDB supports two kinds of relationships: referenced and embedded. Referenced relationships means it stores direct link to the target objects of the relationships. Embedded relationships means it stores the relationship within the record that embeds it. This relationship is stronger than the reference relationship. Database The database is an interface to access the real storage. IT
OrientDB – Backup Database
OrientDB – Backup Database ”; Previous Next Like RDBMS, OrientDB also supports the backup and restore operations. While executing the backup operation, it will take all files of the current database into a compressed zip format using the ZIP algorithm. This feature (Backup) can be availed automatically by enabling the Automatic-Backup server plugin. Taking backup of a database or exporting a database is the same, however, based on the procedure we have to know when to use backup and when to use export. While taking backup, it will create a consistent copy of a database, all further write operations are locked and waiting to finish the backup process. In this operation, it will create a read-only backup file. If you need the concurrent read and write operation while taking a backup you have to choose exporting a database instead of taking backup of a database. Export doesn’t lock the database and allows concurrent writes during the export process. The following statement is the basic syntax of database backup. ./backup.sh <dburl> <user> <password> <destination> [<type>] Following are the details about the options in the above syntax. <dburl> − The database URL where the database is located either in the local or in the remote location. <user> − Specifies the username to run the backup. <password> − Provides the password for the particular user. <destination> − Destination file location stating where to store the backup zip file. <type> − Optional backup type. It has either of the two options. Default − locks the database during the backup. LVM − uses LVM copy-on-write snapshot in background. Example Take a backup of the database demo which is located in the local file system /opt/orientdb/databases/demo into a file named sample-demo.zip and located into the current directory. You can use the following command to take a backup of the database demo. $ backup.sh plocal: opt/orientdb/database/demo admin admin ./backup-demo.zip Using Console The same you can do using the OrientDB console. Before taking the backup of a particular database, you have to first connect to the database. You can use the following command to connect to the database named demo. orientdb> CONNECT PLOCAL:/opt/orientdb/databases/demo admin admin After connecting you can use the following command to take backup of the database into a file named ‘backup-demo.zip’ in the current directory. orientdb {db=demo}> BACKUP DATABASE ./backup-demo.zip If this command is executed successfully, you will get some success notifications along with following message. Backup executed in 0.30 seconds Print Page Previous Next Advertisements ”;
OrientDB – Console Modes
OrientDB – Console Modes ”; Previous Next The OrientDB Console is a Java Application made to work against OrientDB databases and Server instances. There are several console modes that OrientDB supports. Interactive Mode This is the default mode. Just launch the console by executing the following script bin/console.sh (or bin/console.bat in MS Windows systems). Make sure to have execution permission on it. OrientDB console v.1.6.6 www.orientechnologies.com Type ”help” to display all the commands supported. orientdb> Once done, the console is ready to accept commands. Batch Mode To execute commands in batch mode run the following bin/console.sh (or bin/console.bat in MS Windows systems) script passing all the commands separated with semicolon “;”. orientdb> console.bat “connect remote:localhost/demo;select * from profile” Or call the console script passing the name of the file in text format containing the list of commands to execute. Commands must be separated with semicolon “;”. Example Command.txt contains the list of commands which you want to execute through OrientDB console. The following command accepts the batch of commands from the command.txt file. orientdb> console.bat commands.txt In batch mode, you can ignore errors to let the script continue the execution by setting the “ignoreErrors” variable to true. orientdb> set ignoreErrors true Enable Echo When you run console commands in pipeline, you will need to display them. Enable “echo” of commands by setting it as property at the beginning. Following is the syntax to enable echo property in OrientDB console. orientdb> set echo true Print Page Previous Next Advertisements ”;
OrientDB – Alter Database
OrientDB – Alter Database ”; Previous Next Database is a one of the important data models with different attributes that you can modify as per your requirements. The following statement is the basic syntax of the Alter Database command. ALTER DATABASE <attribute-name> <attribute-value> Where <attribute-name> defines the attribute that you want to modify and <attribute-value> defines the value you want to set for that attribute. The following table defines the list of supported attributes for altering a database. Sr.No. Attribute Name Description 1 STATUS Defines the database’s status between different attributes. 2 IMPORTING Sets the importing status. 3 DEFAULTCLUSTERID Sets the default cluster using ID. By default it is 2. 4 DATEFORMAT Sets the particular date format as default. By default it is “yyyy-MM-dd”. 5 DATETIMEFORMAT Sets the particular date time format as default. By default it is “yyyy-MM-dd HH:mm:ss”. 6 TIMEZONE Sets the particular time zone. By default it is Java Virtual Machine’s (JVM’s) default time zone. 7 LOCALECOUNTRY Sets the default locale country. By default it is JVM’s default locale country. For example: “GB”. 8 LOCALELANGUAGE Sets the default locale language. By default it is JVM’s default locale language. For example: “en”. 9 CHARSET Sets the type of character set. By default it is JVM’s default charset. For example: “utf8”. 10 CLUSTERSELECTION Sets the default strategy used for selecting the cluster. These strategies are created along with the class creation. Supported strategies are default, roundrobin, and balanced. 11 MINIMUMCLUSTERS Sets the minimum number of clusters to create automatically when a new class is created. By default it is 1. 12 CUSTOM Sets the custom property. 13 VALIDATION Disables or enables the validations for entire database. Example From the version of OrientDB-2.2, the new SQL parser is added which will not allow the regular syntax in some cases. Therefore, we have to disable the new SQL parser (StrictSQL) in some cases. You can use the following Alter database command to disable the StrictSQL parser. orientdb> ALTER DATABASE custom strictSQL = false If the command is executed successfully, you will get the following output. Database updated successfully Print Page Previous Next Advertisements ”;