OrientDB – Alter Database

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 NameDescription
1STATUSDefines the database’s status between different attributes.
2IMPORTINGSets the importing status.
3DEFAULTCLUSTERIDSets the default cluster using ID. By default it is 2.
4DATEFORMATSets the particular date format as default. By default it is “yyyy-MM-dd”.
5DATETIMEFORMATSets the particular date time format as default. By default it is “yyyy-MM-dd HH:mm:ss”.
6TIMEZONESets the particular time zone. By default it is Java Virtual Machine’s (JVM’s) default time zone.
7LOCALECOUNTRYSets the default locale country. By default it is JVM’s default locale country. For example: “GB”.
8LOCALELANGUAGESets the default locale language. By default it is JVM’s default locale language. For example: “en”.
9CHARSETSets the type of character set. By default it is JVM’s default charset. For example: “utf8”.
10CLUSTERSELECTIONSets the default strategy used for selecting the cluster. These strategies are created along with the class creation. Supported strategies are default, roundrobin, and balanced.
11MINIMUMCLUSTERSSets the minimum number of clusters to create automatically when a new class is created. By default it is 1.
12CUSTOMSets the custom property.
13VALIDATIONDisables 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

Leave a Reply