Connect to Neo4j through C# - neo4j

I have developed a web application using Asp.net, where I am using Neo4j client to connect to my Neo4j database.
static GraphClient client = new GraphClient(new Uri(url), username, password);
client.Connect();
However this requires me to open the Neo4J desktop app and run the database before I can run my web app.
I wonder if it is possible to run the webapp without opening the Neo4J instance physically. i.e., The webapp should communicate with Neo4J in the background like we normally do with SQL databases.

The neo4j Desktop is only really for use during development.
To have a neo4j server that runs all the time, you should download an appropriate non-Desktop release from this page, and install it on a machine or environment that is always available. Chapter 2 of the Operations Manual has installation instructions.

Related

SQL Connection string issue when deploying ASP.NET Core MVC to Azure App Service (Linux)

I have created a simple ASP.NET Core MVC application using EF Core and SQL Server. On the Windows development machine it is using localdb. I am trying to deploy to Azure App Service (Linux). I have created an Azure SQL database. Deploying from Visual Studio 2019, I have set the database as a dependency. In the publish profile settings I have selected the Azure SQL connection string for the database context I am using. I have also checked the EF Migrations and on deployment the script successfully created the tables for the application. I can connect to Azure SQL and see the tables. However when I run the deployed application and try a database operation I get: PlatformNotSupportedException: LocalDB is not supported on this platform
I can see from the docs various ways to set the connection string but I would like to know what the publish wizard in Visual Studio 2019 is trying to do and why it is not working? I'm also unclear where the password is stored. In the publish profile the password seems to be in the connection string as plain text, not good. I'd like to know how to get this right for production.
Update I have fixed this for the moment by following the steps in the Linux tutorial, using the Azure CLI and running the following command:
az webapp config connection-string set --resource-group [myResourceGroup] --name [app name] --settings MyDbConnection='[connection-string]' --connection-string-type SQLServer
I am not sure of the security of this approach and plan to investigate further.
The publish wizard simply handles the database creation/migration for you, it doesn't modify your project, as that's 1) not its purpose and 2) it can't make the configuration decision for you (i.e. use appsettings, environment variables, etc.)
You need to provide the connection string in production via configuration, just as in development. Since you're deploying to an Azure App Service, the most logical place for that would be to the App Settings in the Azure. These will be loaded in via environment variables. Simply specify the same key you're using in development and specify the production database target there.

Neo4J with Spring at my browser

I am new at NoSQL graphs databases. I am learning Neo4J with Java througth https://spring.io/guides/gs/accessing-data-neo4j/.
How can I see my nodes that I created by Java at the http address http://localhost:7474/browser/ ?
That guide uses an embedded Neo4j instance, which is accessible within the Java application. Specifically, this code:
#Bean
GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase("accessingdataneo4j.db");
}
is creating an embedded Neo4j instance in the current working directory with the name accessingdataneo4j.db. To use the Neo4j Browser you'll need to run Neo4j Server. Follow the instructions here to download and install Neo4j.
If you are using the Mac or Windows desktop application you can select the location for the embedded database your created previously - just point the "Database Location" to the location of accessingdataneo4j.db that you created and start the server. Then you can access the Neo4j Browser at http://localhost:7474
If you are not using the desktop application you can set the location of the database directory in conf/neo4j-server.properties:
org.neo4j.server.database.location=/path/to/accessingdataneo4j.db

How to connect Blueprints to a remote neo4j server

I am trying to merge two separate efforts. I have an application that currently uses anormcypher to talk to a remote neo4j database, and I am now developing an application that uses TinkerPop Blueprints.
In Blueprints I can create a new embedded Neo4jGraph but I don't know how to connect it to my remote neo4j (community edition, not HA) server. I'm looking for the documentation that tells me how to configure that connection (host::port).

spring data neo4j, how to access database by broswer when database is loaded by tomcat

I use <neo4j:config storeDirectory="/neo4j/target/data/db"> to config my neo4j database path,
and when tomcat started, the database files are locked by tomcat, and I can't start it using Neo4j official start tool, so how can I access my database in broswer like localhost:7474, or can spring connect a lunched neo4j server like mysql? and then I can access it through broswer.
You can work with one graph instance from one place only. If you are using it via tomcat in your code you wont be able to start it from the community tool. You would need to stop your tomcat and then run the tool to view it in the browser.

How to update the Neo4j webadmin without restarting the server?

I have a Neo4j server running on my machine and access the database via the webadmin interface. Then I run a java application which writes data to the database using the Java API and exists afterwards.
If I then try to see the new data in the webadmin, I have to restart the Neo4j server (refreshing doesn't help).
How can I refresh the webadmin without having to restart the server?

Resources