Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-13-2019 01:19 PM
getting error while trying to run below cyper script
neo4j> cypher-shell -file /var/lib/neo4j/import/testscript.cql;
Invalid input '-': expected (line 2, column 1 (offset: 7))
"-shell -file /var/lib/neo4j/import/testscript.cql;"
Where should we place the cypher scripts(.cql) to execute them? and what is wrong with the above command?
Appreciate your help!.
Thanks,
Solved! Go to Solution.
06-14-2019 11:42 AM
great to know it works
also for reference if you define environment variable NEO4J_USER and NEO4J_PASSWORD, for example
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password
and replacing neo4j
and password
above with the respective values for your implementation then they will be used for -u and -p when running cypher-shell. Thus if you run
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password
cat /var/lib/neo4j/import/testscript.cql | cypher-shell
then it will run the contents of /var/lib/neo4j/import/testscript.cql through a cypher-shell connection and authenticate with the values specified by NEO4J_USER and NEO4J_PASSWORD
06-13-2019 02:17 PM
it looks like you started cypher-shell, and thus the prompt of
neo4j>
but then at this prompt you entered
cypher-shell -file /var/lib/neo4j/import/testscript.cql;
After starting cypher-shell and getting to the neo4j>
prompt the only thing you can do is enter cypher statements. If you want to call cypher-shell and process the contents of a file, and the contents of said file contain a number of cypher statements then this would be accomplished by running
cat <filename with cypher statements> | <command to start cypher-shell>
and thus for your example
cat /var/lib/neo4j/import/testscript.cql | cypher-shell
06-13-2019 06:20 PM
06-14-2019 07:46 AM
what happens when you run
cat /var/lib/neo4j/import/testscript.cql | cypher-shell
06-14-2019 07:47 AM
Thank you Dana.
Tried your recommendation but still getting an error. Please see attached screenshot.
Thanks,
06-14-2019 10:14 AM
do not run the cat /var/lib/neo4j/import/testscript.cql | cypher-shell
when logged into cypher-shell
from the linux prompt, simply run
cat /var/lib/neo4j/import/testscript.cql | cypher-shell
06-14-2019 10:22 AM
Thank you.
Here is the output.
ubuntu@ubuntu:/var/lib/neo4j$ cat /var/lib/neo4j/import/testscript.cql | cypher-shell
The client is unauthorized due to authentication failure.
Thanks,
06-14-2019 10:25 AM
script ran as below
ubuntu@ubuntu:/var/lib/neo4j$ cat /var/lib/neo4j/import/testscript.cql | cypher-shell -u xxxxx -p xxxxx
Thank you for your help.
06-14-2019 11:42 AM
great to know it works
also for reference if you define environment variable NEO4J_USER and NEO4J_PASSWORD, for example
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password
and replacing neo4j
and password
above with the respective values for your implementation then they will be used for -u and -p when running cypher-shell. Thus if you run
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password
cat /var/lib/neo4j/import/testscript.cql | cypher-shell
then it will run the contents of /var/lib/neo4j/import/testscript.cql through a cypher-shell connection and authenticate with the values specified by NEO4J_USER and NEO4J_PASSWORD
All the sessions of the conference are now available online