我一直在尝试在Azure移动服务中使用Neo4j数据库作为我的数据库。我正在关注this tutorial,我似乎无法使其工作。基本上,教程所做的是:Neo4j在Azure移动服务
- 创建由Azure运行的VM,运行ubuntu和neo4j。
- 使用SQL表创建Azure移动服务。
- 为使用node.js连接到Neo4j VM并在那里传输数据的SQL表写入插入脚本。
不幸的是我的工作似乎没有工作。数据被发布到移动服务SQL表中,但发布到虚拟机上的Neo4j服务器的脚本似乎不起作用。我也知道VM安装正确,因为我可以在Neo4j网页管理页面连接到它。
这里是脚本代码:
function insert(item, user, request) {
//comment to trigger .js creation
var neo4j = require('neo4j');
var db = new neo4j.GraphDatabase('http://<username>:<password>@http://neo4jmobile.cloudapp.net:7474');
var node = db.createNode({ name: item.name });
node.save(function (err, node) {
if (err) {
console.error('Error saving new node to database:', err);
}
else {
console.log('Node saved to database with id:', node.id);
}
});
request.execute();
}
没有任何一个有这种经验吗?我的脚本有问题吗?使用教程方法?任何帮助,将不胜感激。
编辑:线路有问题:console.err('Error saving new node to database:', err);
必须用console.err('Error saving new node to database:', err);
取代。不过,我现在得到这个错误信息:
Error saving new node to database: { [Error: connect ETIMEDOUT]
stack: [Getter/Setter],
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
__frame:
{ name: 'GraphDatabase_prototype__getRoot__1',
line: 76,
file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js',
prev:
{ name: 'GraphDatabase_prototype_getServices__2',
line: 99,
file: '\\\\10.211.156.195\\volume-0-default\\bf02c8bd8f7589d46ba1\\4906fa4587734dd087df8e641513f602\\site\\wwwroot\\App_Data\\config\\scripts\\node_modules\\neo4j\\lib\\GraphDatabase.js',
prev: [Object],
active: false,
offset: 5,
col: 12 },
active: false,
offset: 5,
col: 12 },
rawStack: [Getter] }
再次,任何帮助将不胜感激!
您是否在移动服务的日志中看到任何内容? – Chris
您的网址错误。它应该是:'http://: @ neo4jmobile.cloudapp.net:7474' –
@MichaelHunger我改变了网址,不幸的是这不是问题。 –