OrientDB Execute a Script from a Text (.osql) File

1.2k views Asked by At

how to execute orientdb script using windows command line. For Example i have been trying << console.bat script.osql >> but i need a command to execute it from windows command line with username and password . I know usually there is a way in mysql to execute .sql file from command line. IS there any similar way in orientdb ? I'm a newbe to orientdb.appriciate any kind of help Thanx.

1

There are 1 answers

1
Omega Silva On BEST ANSWER

I presume the script.osql file contains a bunch of SQL scripts and you are trying to execute a batch script?

If so you can include the login info in the same file as yet another SQL script and get the job done.

Following is a sample script (say script.osql),

connect remote:localhost/Test2 admin admin;

CREATE CLASS B;
CREATE PROPERTY B.name STRING;

CREATE CLASS A;
CREATE PROPERTY A.name STRING;
ALTER PROPERTY A.name MANDATORY true;
CREATE PROPERTY A.bList LINKSET B;

and you can execute the above batch script using the console.bat. Command similar to below;

console.bat script.osql

Hope this helps.