Reputation: 113
I'm using OrientDB 2.0.2. I'm writing a SQL script that will create a new DB, construct the schema, and then populate the DB with static initial data. I know that the database will be automatically created if I simply start loading data, and that classes will automatically be created if I start inserting records, but I want to make sure that my classes have the right inheritance and Properties and Indexes before I begin my data load.
The SQL syntax is easy - I just need to know how to run the SQL script from the command line in order to instantiate the the DB, as if I were deploying a new instance of my DB at a new location, or for a new customer.
Thanks.
Upvotes: 3
Views: 2701
Reputation: 574
According to the latest doc, you can do below:
sh console.sh
orientdb> LOAD SCRIPT /path/to/scripts/data.osql
Here is the link: https://orientdb.com/docs/3.1.x/console/Console-Command-Load-Script.htm
Upvotes: 0
Reputation: 12859
Assuming you installed OrientDB in the base directory ORIENTDB_HOME
, then go to the $ORIENTDB_HOME/bin
directory. In this directory, execute the OrientDB SQL Script with the simple command:
*nux:
$ ./console.sh myscript.osql
Windows:
> console.bat myscript.osql
mysql.osql
is a simple text file, containing all SQL command (.oslq
is a typical file extension for OrientDB SQL scripts).
See documentation for details how to create a new database. Example:
CREATE DATABASE plocal:/usr/local/orient/databases/demo/demo
or
CREATE DATABASE remote:localhost/trick root verySecretPassword
Upvotes: 6