I am new to neo4j and based on the reading I have done so far it seem there are two ways to interact with neo4j using Neo4j REST and Embedded. Where I am a little confused is does the Embedded option only give you the ability use the native Neo4j API to manipulate the datastore or can you also embed Neo4j and package it with your java application and if so how would I go about doing it?
As far as I know, Embedded term coined out to integrate neo4j with your application. In embedded mode, your db is locked and your application is solely authorized to access it. You can not access your db from any where else as far as your application is running and accessing it.
Where as in Neo4j Rest or Say Neo4j Server support REST API through which you can perform all the data store related operation via API call. In Rest API mode, you can handle your db externally using Neo4j GUI console along with your application.
Performance wise, I found embedded mode is much faster than Server mode.
does the Embedded option only give you the ability use the native Neo4j API to manipulate the datastore
You can use either of mode (Server REST API mode or embedded mode) to manipulate datastore.
Package with Java Application
it depends on your application configuration, in embedded mode you generally don't need external neo4j server running. You just need to explicitly mention your db path along with other configuration (I have used Spring data neo4j). Where as in Neo4j Server mode, you will require neo4j server running.
You can have look on this thread as well.
Related
I have a java web application which i'm developing using a local embedded HSQL database. Is there kind of a servlet which I can plug-in into my application and expose it /dbconsole, where I can fire sql statements, inspect tables, fields and table data?
I think you can try H2 Database which is a fast java opensource database. It can be easily embedded and it has a build-in servlet (org.h2.server.web.WebServlet) for db admin usage. We have used it in our production several years and it is very stable.
Here's its web console UI rendered by org.h2.server.web.WebServlet:
I have an embedded Neo4j database created and used by a java process utilizing TinkerPop. I would like to use the Neo4j web admin and backup service with this database. I have now installed the server, but when I try to set the server database path to the existing embedded database, I get a StoreLockException (Could not create lock file) when starting the server.
How do I make this work so that I can administer and back up my database? Since I'm using TinkerPop, I actually have no direct Neo4j references in my code. The database used comes from a configuration file. I would like to avoid having to make hard dependencies on Neo4j in the code.
You can't access the database directory from two different processes at the same time. This isn't a code-level concern, just an operational concern.
You'd have to:
Shutdown your application (thereby releasing the lock)
Run a backup using Neo4j tooling (of your choice)
Start your application back up again
For "live" backups without shutting down your application, you'd need to run a cluster using Neo4j Enterprise.
Cheers,
Andreas
I need to deploy neo4j in embedded mode to a cloud solution(such as heroku) and store the database somewhere else - i am thinking about multiple problems.
If i store in s3, i will have to retrieve the database, load it all in memory, and then send updates constantly with the new database. This is obviously not valid.
I am reluctant to using the neo4j add-on, because i can only use the REST calls, can only deploy in the US region, and i can't use server plugins.
Any ideas/solutions?
Best
I'm one of the founders of GrapheneDB. We don't support embedded mode, but we are about to release support for custom plugins and server extensions.
Our shared databases are hosted in the US and our dedicated servers can be setup in any AWS region.
You should check http://www.graphenedb.com/ which is a hosted neo4j service.
I've read some articles on the Internet that this is not possible. To communicate own SQL database that is located on other server from GWT application. Jetty doesn't allow it.
I found a way how to perform it but it's not very cosy. I have client and server part inside GWT. The server has to communicate with MySQL database on localhost. So I've written an ant script to build a war that I can launch on Apache Tomcat server. It works perfectly there but I'm not able to debug the code effectively.
Do you have some advices how to perform this task? I was thinking of writing the clienty only in GWT and find some waz how to communicate my own server written outside the GWT. I've found Apache Thrift for GWT but this edited library of thrift seem not to work properly.
Thank you very much for your answers:)
It is possible to communicate with a database from a GWT application. The client side has to call the methods of the server via GWT-RPC, which can communicate with any database.
Maybe Jetty does not support it (have not tested it personally) but you can develop your web application using Apache too. There you can access the database the same way as from any web application:
You will need the mysql-connector-java-5.1.20-bin.jar file (downloadable from: http://dev.mysql.com/downloads/connector/j/ ), and restart the server added to the $CATALINA_HOME/common/lib directory.
OR added to the WEB-INF/lib folder of your web application.
You can find tutorials online of how to develop an application using Tomcat instead of Jetty. For example: https://wiki.auckland.ac.nz/display/BeSTGRID/Deploying+GWT+to+Tomcat+in+Eclipse
Reshi, stop and think about how applications really work. Nobody provides web pages with javascript to read/write databases, that would be crazy and unsecure. Servers are always in themiddle of all communication in this case. You need to create services that run inside your server, one of these services will be a database layer.
Javascript cant create network connections and read/write binary data, thus it would be insane to attempt to get the gwt compiler to compile any jdbc drvier and more.
Jetty does NOT stop us from connecting to a database. All you have to do is to follow the MVP model way. Although MVP is better bet against all hurdles, at a minimal point, you would have to try not having SQL code on the client package.
I've made a Google Web Application Project in Eclipse and am now running into problems as I need to use from a server side point of view, with Hibernate with MySQL. I've just been told that Google Web Application projects can't run Hibernate connections to MySQL as they're deployed projects.
What's the best way for me to migrate this project somehow so it runs on say Glassfish and just uses GWT for the client side technologies that can then use Hibernate and MySQL, rather than actually being deployed?
Thanks,
David
You cannot access database from client-side directly.
GWT translates your client-side java code into Javascript which runs in browser; there is no way to directly access JDBC.
You will have to employ server-side which will handle your DB persistence. Your client can communicate via GWT-RPC, JSON, XML, or any other protocol - but the database connection part will always reside on server.
Note that the server part does not need to be in Java - it can use PHP or any other technology, as long as it understands the javascript generated out of your app.