Import csv file in javascript error

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:})
    .then(function (result) {
      const links = => { return {source:r.get('source').toNumber(), target:r.get('target').toNumber()}});
      const ids = new Set();
        l => {ids.add(l.source);ids.add(;}
      var gData = { nodes: Array.from(ids).map(id => {return {id}}), links: links};
      const Graph = ForceGraph3D()(document.getElementById('MyIndexRenderers')).graphData(gData);
    .catch(function (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.

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

Thank you,
It was nice. have a nice day !

1 Like