# Requesting Neo4j database with java application

**URL:** <https://community.neo4j.com/t/requesting-neo4j-database-with-java-application/14340>\
**Category:** Java\
**Created:** [February 4, 2020, 4:12pm UTC](https://community.neo4j.com/t/requesting-neo4j-database-with-java-application/14340 "2020-02-04T16:12:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![madiskou](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/madiskou/32/16515_2.png) [@madiskou](https://community.neo4j.com/u/madiskou)\
**Post date:** [February 4, 2020, 4:12pm UTC](https://community.neo4j.com/t/requesting-neo4j-database-with-java-application/14340/1 "2020-02-04T16:12:33Z")

</div>

Hello,

I am new with neo4j, i will use the community version.  
I want to know how can i request the database within a java application, i don't want to create nodes/relationships (the database is created in another project ) but i want to connect to the db and add a label for a node (my graph represents a VM's and their relationships, when there is a problem with a VM, i want to add a label for example :alert for this node which implicate changing the color + size of this node).  
How can i do this? Is there several manner to do it?

Thank you,

---

<div class="post-metadata">

**Author:** ![jorenvandevondel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jorenvandevondel/32/4350_2.png) [@jorenvandevondel](https://community.neo4j.com/u/jorenvandevondel)\
**Post date:** [February 7, 2020, 3:11pm UTC](https://community.neo4j.com/t/requesting-neo4j-database-with-java-application/14340/2 "2020-02-07T15:11:14Z")

</div>

Hi Madiskou,

you could integrate the official neo4j java bolt driver in your project. ([Get started - Neo4j Driver Manual](https://neo4j.com/docs/driver-manual/1.7/get-started/#driver-get-started-about))  
When you have this driver and can create a session you could simply write a query that matches the node you'd like to update based on an id (for performance reasons you should index that id) and then set the label on the node

```auto
HashMap<String, Object> params = new HashMap<>();
params.put('id', some_id)
session.run("MATCH (vm:VM {id:$id}) SET vm:ALERT",params)"

```

The code above shows how you could go about this, putting the id in the run parameters allows for query caching and speedup. Here i construct a java map with the arguments and then run the query with the map added. For additional information look towards to documentation.

Hope this helps you.  
Kind regards,  
Joren
