Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-03-2021 09:03 PM
Hello,
I try import csv file in javascript, but failed.
step1. Create Local database in neo4jtool
step2. write in javascript
const neo4j = require("neo4j-driver");
const driver = neo4j.driver("bolt://localhost:7687", neo4j.auth.basic("TestGraph", "1234"),{encrypted: true});
const session = driver.session();
const start = new Date();
let isDoneSession = session
.run('Load csv with headers from "Datas/testtes2t.csv" as attackgraph create(a1:AttackGraph {attack_no: attackgraph.attack_no, attack_seq: attackgraph.attack_seq, from_id: attackgraph.from_id})', {limit: neo4j.int(5000)})
.then(function (result) {
const links = result.records.map(r => { return {source:r.get('source').toNumber(), target:r.get('target').toNumber()}});
session.close();
const ids = new Set();
links.forEach(
l => {ids.add(l.source);ids.add(l.target);}
);
var gData = { nodes: Array.from(ids).map(id => {return {id}}), links: links};
const Graph = ForceGraph3D()(document.getElementById('MyIndexRenderers')).graphData(gData);
})
.catch(function (error) {
console.log("Error!!!!!!!");
});
step3. failed.....
browser-channel.js:60 WebSocket connection to 'wss://localhost:7687/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
why this happened?
please help me.
Thank you.
01-09-2021 03:12 PM
The default user name is neo4j
not TestGraph
you have to put the csv file into the import folder of your database and then use file:///name.csv
Best take the import training
01-10-2021 09:08 PM
Thank you,
It was nice. have a nice day !
All the sessions of the conference are now available online