I want to build a RESTful Application with Spring using Neo4j as a Database.
What I (very simply) want to have, is an application that takes entities (like a user) via POST, persists them in a Neo4j Database and loads them on a GET.
I tried the spring tutorials (build an embedded graphdb and also accessing an external graphdb via rest) for that and it worked, but it seems that i can't use the neo4j standalone to view the database live, because it seems to be locked by my application.
It is important for me to have some kind of method to view the live database, so I'm stuck.
So basically I'm looking for a simple way to have an application writing to and reading from an external graphdb, which I can manipulate with the neo4j standalone (or some alternative program).
I' asking here, because at this point I don't even know what to goole anymore :)
There are two options: http://neo4j.com/developer/spring-data-neo4j
1) with Spring Data Neo4j version 4 you can work against Neo4j server
2) with Spring Data Neo4j 3, you can move your code into a server extension
3) there is also an option to start Neo4j server with an embedded database (this should only be done during development not production)
Thanks to your answers, I have some examples that show me the intended use of Neo4j which helps me a lot.
Basically github.com/neo4j-examples?utf8=%E2%9C%93&query=sdn4 was the answer to all my questions, since it provides me with a useful "look how it's done".
Thank you.
Related
I have a web application that has to be linked with a graph database (Neo4J). Is it possible to read or write data to Neo4J using Appery?
I have chosen Appery because I am a beginner when it comes to databases and Appery seems to be easy in using REST API, as well as there is a free trial.
Feedback would be highly helpful. Thanks in advance.
Edit: I am aware that Neo4J uses Cypher queries. I would like to know if Appery supports Cypher as well.
Side note: The reason I am asking the question here without trying it out is because I dont have an active DB and my application is private due to my company's security policy
You can do that as long as Neo4J database has a REST API. If it does, then you can make calls to it from an Appery app (from Server Code or API Express). Hope this helps.
I'm using Spring Data for Neo4j and MongoDB, I find it awesome, but now I just found out about the embedded and not embedded DB stuff.
Here's my situation :
Using Spring Data with the annotations, repositories, templates and thinking that I just need to change the DB address to make it work elsewhere.
My questions :
1) I don't even understand what they mean by embedded vs non embedded (on the same machine vs on a distant machine ?)
2) Do I have to change all the work I've done to make it work with a 'non embedded' DB ?
What I wan't to do is to deploy my Spring Boot app that is using Neo4j to Heroku or CloudFoundry and use Graphen (Neo4j paas) for the DB. But when I saw all this story about Spring Data working only for embedded, I just lost all the hope and happiness I had when building my app.
3) If 2) is Yes, is it an easy transition ? is there a lot of things to change ?
EDIT :
Here's what I'm talking about :
http://inserpio.wordpress.com/2014/04/30/extending-the-neo4j-server-with-spring-data-neo4j/
He's adding some custom boilerplate code to make it work with a non embeded DB, is it ok ? Why it doesn't work as any other DB (like with JPA, where you just specify the address of the DB).
inserpio here. Don't lose your happiness, please: Spring Data Neo4j team is working hard to implement a new release that improves remote performances.
When Spring Data Neo4j started neither Cypher nor Neo4j-Server existed, while only the embedded version was available. As the server version was delivered SDN team provided a quick solution that works well if you only use repositories, but becomes a little bit too chatty is you want to use #Entity too. The problem is matching those #Entity with the returned nodes.
Since the new version is still not completed, for the moment, you could move you persistence-logic more tight to the database as a server extension. I explained it on the link you mentioned. It's a really fast refactoring: just move your entities and repositories to a new simple java project, install the resulting jar in the 'plugins' folder, one line configuration in the neo4j-server.properties and expose your queries as simple REST services.
Hope this could help.
Do not hesitate to contact me for any further question.
Cheers,
Lorenzo
I am using Spring Data in my Java application to connect to MongoDb and have a requirement around versioning the documents (basically storing the history).
It seems that its pretty straightforward in Ruby, if one uses Mongoid
I was wondering if spring data has something similar for Java. Or are you better of trying to implement your own.
Yes there is a very good feature in Spring data which is auditing you can refer to the following link
http://www.javacodegeeks.com/2013/11/auditing-entities-in-spring-data-mongodb-2.html
After lot of research I found that https://javers.org/documentation/spring-boot-integration/. This works like rock solid and very easy to implement.
This library helps to store all the history of the changed fields and easy to query over it and it has great support of it. The sample POC shared here: https://nullbeans.com/auditing-using-spring-boot-mongodb-and-javers/
now I have an iPhone App and basically I want to exchange data from my database (MongoDB) on a server.
Could you please tell me exactly what I should do?
Forgive my innocence, I am a beginner in this area...Thank you very much ahead of time!!
I think you have two options to talk to mongo :
1) Use the rest interface http://www.mongodb.org/display/DOCS/Http+Interface
2) Use Objective-C driver: https://github.com/timburks/NuMongoDB
If you're not completely tied to MongoDB, have a look at CouchDB. It's essentially the same thing as MongoDB (JSON document store) but for the web. They have a nice built-in REST interface which makes database interaction in mobile/server environments very nice.
http://couchdb.apache.org/
In addition to Sid's options, you can also build your own backend that talks to mongodb, that communicates via REST (in your language of choice). This way you can pool your connections on the backend and avoid connectivity issues from the devices.
I am looking for a tutorial on how to make an iPhone app that fetches data from and writes data to a MySQL database. I've seen some other threads saying that I should make an abstraction layer so as not to connect directly to the database from my app, but I'm not sure of how to actually go about doing this. Does anyone know of any tutorials that involve creating an abstraction layer for a MySQL database or connecting a MySQL database to an iPhone app?
To clarify, I am looking for a secure method that wouldn't allow people to sniff out my MySQL host, username and password. It seems like the libraries that connect directly to MySQL from the iPhone all have this problem, but please correct me if I'm wrong.
This is a really good tutorial that covers how to communicate with MySQL from an iPhone app using PHP:
http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app
I know only one library, which makes possible connection from iPhone to MySQL. This is port of official MySQL C libraries created by Karl Kraft.
Author published also small portion of samples, which describes how to use this library.
UPDATE (Karl Kraft's broken link)
Instead of link above, I used an archived copy.
not up to date, but this tutorial helped me a lot:
http://codewithchris.com/iphone-app-connect-to-mysql-database/#connectiphonetomysql
Here http://blog.iosplace.com/?p=30 is a snippet that uses the original mysql client lib, and here http://www.karlkraft.com/index.php/2012/01/ is a link to a 3rd-party connector.
Here is a nice tutorial on how to connect to a database using web service layer.
From a practical perspective you could connect directly to a database from an iphone because that is a client server transaction. The problem is that you would need to expose your database server an issue that many would find very disturbing, because you would expose your server which hold your most valuable resource "your data". Of course you can implement and could be a good solution for rather small projects. But you would need to implement the layer which it would be used to connect on the iOS app, adding more complex to the matter.
Using a web service is more reliable even from the iOS developer, because there is a very extensive api for using web service, which offer great functionality (asynchronous transactions, threads management,JSON Mapping, XML Mapping) to name a few.
Use the library OHMySQL. It copes with MySQL through MySQL C API.