1
我在嵌入模式下使用neo4j。因此,對於服務器上的數據庫中的一些操作,我正試圖執行groovy腳本。 Groovy腳本運行成功,沒有任何錯誤,但是當我檢查neo4j-communinty工具時,它不會創建任何新記錄。Neo4j:Groovy腳本沒有插入任何東西
腳本
/**
* Created by prabjot on 7/1/17.
*/
@Grab(group="org.neo4j", module="neo4j-kernel", version="2.3.6")
@Grab(group="org.neo4j", module="neo4j-lucene-index", version="2.3.6")
@Grab(group='org.neo4j', module='neo4j-shell', version='2.3.6')
@Grab(group='org.neo4j', module='neo4j-cypher', version='2.3.6')
import org.neo4j.graphdb.factory.GraphDatabaseFactory
import org.neo4j.graphdb.Node
import org.neo4j.graphdb.Result
import org.neo4j.graphdb.Transaction
class Neo4jEmbeddedAccess {
public static void main(String[] args) {
def map=[:]
map.put("allow_store_upgrade","true")
map.put("remote_shell_enabled","true")
def db = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder("/opt/neo4j-community-3.0.4/data/databases/graph.db")
.setConfig(map)
.newGraphDatabase()
Transaction tx =db.beginTx()
Node person = db.createNode();
person.setProperty("name","prabjot")
print("id---->" + person.id);
Result result = db.execute("Match (country:Country) where id(country)=73 SET country.modified=true return country")
print(result)
tx.success();
println """starting embedded graph db
use bin/neo4j-shell from a new distribution to connect
we're keeping the graphdb open for 120 secs"""
db.shutdown()
}
請幫我在做什麼錯在這裏,我檢查了我的數據庫位置,但同我正在使用的腳本和工具。
感謝
Thanku它工作正常。但是我擔心一個問題,如果我想改變數據庫中的某些東西,我應該關閉應用程序,我認爲這是不可能的,因爲它給我鎖定文件錯誤。所以你可以建議我如何在使用嵌入模式時修復生產中的錯誤數據。 –