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
Related
I have made a JAVA Desktop Application using Eclipse and MySQL as a database. I want to use the application in another PC with all my created schema and data. How can I bundle or make an installation file so that it installs mysql with the required schema and the JAR file of my application into another pc?
Note: I know we can use embedded Database like H2, Sqlite but I want it to be done using MySQL only. So no suggestions on using other database for my application.
Not sure how your application architecture but below point or solution could help you.
Solution 1 :
You can create DDL for schema database and the insert data. Once your application successfully install, you just run the script to execute this DDL file. Can be done in automation installation script.
Solution 2 :
You can dump mysql and restore to other PC. No worry about the structure, it completely clone from the original including data. Can be done in automation installation script. Dump mysqlDB link
Solution 3 (not recommended):
You can copy entire mysql data in directory and paste to other machine mysql directory. Based on my experience, never success. But look at this guy link
There is a pro and cons using embedded SQL or centralize SQL. If you stick with this kind of architecture, you should consider use embedded SQL like you mention.
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.
I have prepared an application that is a small demo of Student information manipulation. I have stored information related to students in a MySQL DB. Now my application is working 100% on my computer. But I want that work everywhere without depending on Database! I mean I just want "WHEREVER MY .JAR FILE GOES, DATABASE SHOULD ALSO GO ALONG WITH THAT INSIDE .JAR FILE "
So anyone who is using my application or trying it, they can realize exact result of this application.
How can I make this possible? Please someone help me.
For that I have done the following things:
I have installed MySQL database on my computer.
I have created a database on that MySQL server
I have created some tables in the database with a lots of data.. this data is to be used in my whole application, even for login.
Now I want to deliver this application to various clients but my clients are not technical persons and I don't want to give instructions to each of my client to do the above four steps.
How can I integrate some functionality into my app so that they can use my database, Tables and Data automatically .
It would be much better if the code can install the MySQL database automatically from the setup file attached with the application.
How the applications available in the market manage information
Have you thought of using another database engine?
MySQL requires the server to be installed and configured, and it is a huge task to be done by an automatic installer.
What about using for example SQLite http://www.sqlite.org/ or Apache Derby http://db.apache.org/derby/. Both of them work by creating a file in your working dir, you could setup the database and populate data at install time
I have two suggestions for you:
A. Use SQLite instead of MySQL. SQLite is an embeddable database engine and does exactly what you need. You can simply copy the .sqlite file where all the information is stored and distribute it with your JAR file. Given that you've already written you app to use MySQL, this could mean making a few changes to your code.
There is a good SQLite jdbc driver at:
https://bitbucket.org/xerial/sqlite-jdbc
I've used it before, though not extensively.
B. Use a portable installation of MySQL. If you are using Windows these are available on the MYSQL page, look for the downloads marked "ZIP Archive" instead of "MSI Installer". These versions are portable in that they do not require an installation process, just unzip the file, and start the service. Your clients need to know how to start it up, of course. Perhaps you could create a shortcut for that.
Of course, the idea of MySQL being a network server is so that everyone in the enterprise works with the same data, by connecting to the same server. If your clients will use this application in various computers in the same company, you should consider having a single MySQL Server installed, and making the clients connect to that.
Hope this helps!
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 am developing a web application and this web application is to be sold to many people. The application is being developed in Java Spring. The application has a database and when sold this database could be on different locations.
Where is the best way to store this database location so the Java code can find the database?
I would store it in a XML file but where would it go, so that the database location can be changed easily by someone.
I don't want to store it in the Spring Beans. Is there another way?
The problem is that it's a web application, which suggests that you'll give them a WAR file. All the Spring configuration and properties will be packaged; changing something will mean opening the package, which you don't want them to do.
You should set up database access using JNDI names, which are set on the app server the package is deployed to. Give instructions to show how to set one up for Tomcat and other app servers. When your app starts, it'll get the data source name from the app server.
You're assuming that they'll be sophisticated enough to be able to create a JNDI data source on their app server or that your documentation is good enough. Good luck with that.
Another thought would be for you to create a small in memory database like Hypersonic or Derby that comes with configuration information for your app. Tell users to put it in a location outside the app that you specify (e.g. c:/yourApp/configuration), provide a script to start it up when the app starts, and let your application query for database connection information when it loads.
Now you'll be counting on them knowing how to create INSERT or UPDATE queries for your in-memory database. But your chances of writing documentation to instruct how to do it are better, because you don't have to figure out how to do it for WebLogic, Tomcat, Jetty, JBOSS, WebSphere, Glassfish, and every other Java EE app server.