Neo.ClientError.Statement.ExternalResourceFailed on Windows - windows

I just install neo4j 3.2.3 on my windows notebook and I try to load csv file.
LOAD CSV WITH HEADERS FROM 'file:///test.csv' AS line
WITH toUpper(line.TEST_NAME) AS TEST_NAME
CREATE(TEST);
I got the following error:
Neo.ClientError.Statement.ExternalResourceFailed: Couldn't load the external resource at: file:/C:/Users/*****/Documents/Neo4j/default.graphdb/import/test.csv
I cannot locate the neo4j.conf or propriety files in the default.graphdb directories.
can someone help?
I'm on windows 10 neo4j 3.2.3.
I can load from url. but with the same file format, I failed to load from local.
LOAD CSV FROM "https://gist.githubusercontent.com/jexp/d788e117129c3730a042/raw/a147631215456d86a77edc7ec08c128b9ef05e3b/people_leading_empty.csv"
AS line
WITH line LIMIT 4
RETURN line
successful
with the same file save as .../Neo4j/default.graphdb/import/test1.csv
LOAD CSV WITH HEADERS FROM "file:///test1.csv" AS line
WITH line LIMIT 4
RETURN line
I got error:
Neo.ClientError.Statement.ExternalResourceFailed: Couldn't load the external resource at: file:/C:/Users/....../Documents/Neo4j/default.graphdb/import/test.csv
From the error message, it can locate the file. But cannot perform the LOAD from local.

I cannot locate the neo4j.conf or propriety files in the
default.graphdb directories.
According to the Neo4j docs, the neo4j.conf file is located in the directory <neo4j-home>\conf\neo4j.conf for zip packages and %APPDATA%\Neo4j Community Edition\neo4j.conf for desktop installation.
You should locate the configuration file and set the following line.
dbms.security.allow_csv_import_from_file_urls=true

The LOAD CSV operation in Neo4j can only load the UTF-8 format files, try to change the import file's format to UTF-8(save the .csv file as .csv(utf-8) type).

Related

Use Apache Daffodil cmd interface

I am new to Apache Daffodil and am trying to follow the example provided: https://daffodil.apache.org/examples/
I am trying to parse the file, simpleCSV using the schema, csv.dfdl.xsd. Both files are in the same folder as the daffodil.bat folder.
In cmd, I run .\daffodil.bat parse --schema csv.dfdl.xsd simpleCSV.csv
I get the error:
[error] Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; DaffodilXMLLoader: Unable to resolve schemaLocation='csv-base-format.dfdl.xsd'.
Schema context: file:/C:/Users/rinat/OneDrive/Desktop/WORK%20STUFF/apache-daffodil-3.4.0-bin/apache-daffodil-3.4.0-bin/bin/csv.dfdl.xsd Location in file:/C:/Users/rinat/OneDrive/Desktop/WORK STUFF/apache-daffodil-3.4.0-bin/apache-daffodil-3.4.0-bin/bin/csv.dfdl.xsd`
How do I resolve this?
You need to copy csv-base-format.dfdl.xsd (found in the same src/ directory as csv.dfdl.xsd) into the same directory as your csv.dfdl.xsd file. That file provides a number of default settings imported by csv.dfdl.xsd, so they must be in the same directory.

What path should be used to locate CSV File used in SQL statement (Load data local infile) When WAR file Deployed on Tomcat

I have been working on Spring Boot project, I am using Flyway for database version control in this project. In migration folder there are some SQL files having "Load data local infile" Statements - referencing some CSV files.
Example:
load data local infile 'C:/Program Files (x86)/Apache Software Foundation/Tomcat 8.5/webapps/originator/WEB-INF/classes/insertData/subject.csv' INTO TABLE subject
How can I make this path relative?
I have tried
'./classes/insertData/subject.csv'
'./insertData/subject.csv'
And some other combinations also but could not fixed this issue
Error:
Caused by: java.sql.SQLException: Unable to open file '../../insertData/subject.csv'for 'LOAD DATA LOCAL INFILE' command.Due to underlying IOException:
BEGIN NESTED EXCEPTION java.io.FileNotFoundException MESSAGE:
....\insertData\subject.csv (The system cannot find the path
specified) STACKTRACE: java.io.FileNotFoundException:
....\insertData\subject.csv (The system cannot find the path
specified)
I was able to insert data into tables from CSV files within a flyway migration from a resource path. Within the migration script I used the entire path written as shown below.
LOAD DATA LOCAL INFILE './src/main/resources/<FOLDER>/<FILE>.csv' INTO TABLE <TABLE_NAME>
FIELDS TERMINATED BY ','
optionally enclosed by '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
The other statements would be dependent on your file structure I just wanted to include the entire example.
Instead of writing SQL script you can use Java-based migration to read and insert data into a table. You can use "flyway.locations" property to specify the path for java based migration in your application.properties. As flyway by default search for "./db/migration" of resources.
For further details check the https://flywaydb.org/documentation/migrations#java-based-migrations

How can using Jena read file from HDFS and convert it to Rdf?

I'm using Apache Jena to convert a .csv file to .rdf. I use model.read(pathFile), but it only reads file from the local filesystem. I want to read from hdfs, such as model.read(hdfs://....), but it gives an error.
And the error is:
Exception in thread "main" org.apache.jena.riot.RiotNotFoundException: Not found: hdfs://localhost:54310/user/hduser/demo/departments/part-00000.csv
How can I do it?
You will need to add a Locator to the StreamManager to handle "hdfs://".
Jena does not ship with code for reading HDFS URLs.

XPCOMGlueLoad error for file /usr/local/firefox/libxul.so

When running firefox on centos. I am getting the following error. How do i resolve this?
XPCOMGlueLoad error for file /usr/local/firefox/libxul.so:
libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

SimpleXml tar.gz

I'm using SimpleXml to parse xmls. Sadly I've approached XML zipped into tar.gz.
When i try to load this XML i get error
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /home/
Is there any way to work on tared file? If not how can untar this and work on it (it's 12 MB tared file on outside server)?
Kindest regards

Resources