File tree Expand file tree Collapse file tree 5 files changed +167
-0
lines changed Expand file tree Collapse file tree 5 files changed +167
-0
lines changed Original file line number Diff line number Diff line change
1
+ == Installation
2
+
3
+ The .NET driver is distributed via the NuGet Gallery.
4
+ To find the latest version of the driver, visit
5
+ link:https://www.nuget.org/packages/Neo4j.Driver/.
6
+
7
+ == Connect to the database
8
+
9
+
10
+ [source, csharp, role=nocollapse]
11
+ ----
12
+ using Neo4j.Driver;
13
+
14
+ const string uri = "{neo4j-database-uri}";
15
+ const string user = "<Username>";
16
+ const string password = "<Password>";
17
+
18
+ await using var driver = GraphDatabase.Driver(uri, AuthTokens.Basic(user, password));
19
+ await driver.VerifyConnectivityAsync();
20
+ ----
Original file line number Diff line number Diff line change
1
+ == Installation
2
+
3
+ From within a module, use `go get` to install the link:https://pkg.go.dev/github.com/neo4j/neo4j-go-driver/v5/[Neo4j Go Driver]:
4
+
5
+ [source, bash]
6
+ ----
7
+ go get github.com/neo4j/neo4j-go-driver/v5
8
+ ----
9
+
10
+ link:https://neo4j.com/docs/go-manual/current/install/#install-driver[More info on installing the driver ^]
11
+
12
+
13
+ == Connect to the database
14
+
15
+ Connect to a database by creating a `DriverWithContext` object and providing a URL and an authentication token.
16
+ Once you have a `DriverWithContext` instance, use the `.VerifyConnectivity()` method to ensure that a working connection can be established.
17
+
18
+ [source, go, role=nocollapse]
19
+ ----
20
+ package main
21
+
22
+ import (
23
+ "context"
24
+ "github.com/neo4j/neo4j-go-driver/v5/neo4j"
25
+ )
26
+
27
+ func main() {
28
+ ctx := context.Background()
29
+ // URI examples: "neo4j://localhost", "neo4j+s://xxx.databases.neo4j.io"
30
+ dbUri := "{neo4j-database-uri}"
31
+ dbUser := "<Username>"
32
+ dbPassword := "<Password>"
33
+ driver, err := neo4j.NewDriverWithContext(
34
+ dbUri,
35
+ neo4j.BasicAuth(dbUser, dbPassword, ""))
36
+ defer driver.Close(ctx)
37
+
38
+ err = driver.VerifyConnectivity(ctx)
39
+ if err != nil {
40
+ panic(err)
41
+ }
42
+ }
43
+ ----
Original file line number Diff line number Diff line change
1
+ == Install Driver
2
+
3
+ Add the Neo4j Java driver to the list of dependencies in the `pom.xml` of your Maven project:
4
+
5
+ [source, xml, subs="attributes+"]
6
+ ----
7
+ <dependency>
8
+ <groupId>org.neo4j.driver</groupId>
9
+ <artifactId>neo4j-java-driver</artifactId>
10
+ <version>5.20.0</version>
11
+ </dependency>
12
+ ----
13
+
14
+ link:https://neo4j.com/docs/java-manual/current/install/#install-driver[More info on installing the driver ^]
15
+
16
+ == Connect to the database
17
+
18
+ Connect to a database by creating a `Driver` object and providing a URL and an authentication token.
19
+ Once you have a `Driver` instance, use the `.verifyConnectivity()` method to ensure that a working connection can be established.
20
+
21
+ [source, java, role=nocollapse]
22
+ ----
23
+ package demo;
24
+
25
+ import org.neo4j.driver.AuthTokens;
26
+ import org.neo4j.driver.GraphDatabase;
27
+
28
+ public class App {
29
+
30
+ public static void main(String... args) {
31
+
32
+ // URI examples: "neo4j://localhost", "neo4j+s://xxx.databases.neo4j.io"
33
+ final String dbUri = "{neo4j-database-uri}";
34
+ final String dbUser = "<Username>";
35
+ final String dbPassword = "<Password>";
36
+
37
+ try (var driver = GraphDatabase.driver(dbUri, AuthTokens.basic(dbUser, dbPassword))) {
38
+ driver.verifyConnectivity();
39
+ }
40
+ }
41
+ }
42
+ ----
Original file line number Diff line number Diff line change
1
+ == Installation
2
+
3
+ Install the Neo4j JavaScript driver with `npm` :
4
+
5
+ [source,bash]
6
+ ----
7
+ npm i neo4j-driver
8
+ ----
9
+
10
+ link:https://neo4j.com/docs/javascript-manual/current/install/#install-driver[More info on installing the driver ^]
11
+
12
+
13
+ == Connect to the database
14
+
15
+ Connect to a database by creating a `Driver` object and providing a URL and an authentication token.
16
+ Once you have a `Driver` instance, use the `.getServerInfo()` method to ensure that a working connection can be established by retrieving the server information.
17
+
18
+ [source, javascript]
19
+ ----
20
+ var neo4j = require('neo4j-driver');
21
+ (async () => {
22
+ // URI examples: 'neo4j://localhost', 'neo4j+s://xxx.databases.neo4j.io'
23
+ const URI = '{neo4j-database-uri}'
24
+ const USER = '<Username>'
25
+ const PASSWORD = '<Password>'
26
+ let driver
27
+
28
+ try {
29
+ driver = neo4j.driver(URI, neo4j.auth.basic(USER, PASSWORD))
30
+ const serverInfo = await driver.getServerInfo()
31
+ console.log('Connection established')
32
+ console.log(serverInfo)
33
+ } catch(err) {
34
+ console.log(`Connection error\n${err}\nCause: ${err.cause}`)
35
+ }
36
+ })();
37
+ ----
Original file line number Diff line number Diff line change
1
+ == Install Driver
2
+
3
+ [source, bash]
4
+ ----
5
+ pip install neo4j
6
+ ----
7
+
8
+ link:https://neo4j.com/docs/python-manual/current/install/#install-driver[More info on installing the driver ^]
9
+
10
+ == Connect to the Database
11
+
12
+ Connect to a database by creating a `Driver` object and providing a URL and an authentication token.
13
+ Once you have a `Driver` instance, use the `.verify_connectivity()` method to ensure that a working connection can be established.
14
+
15
+ [source, python]
16
+ ----
17
+ from neo4j import GraphDatabase
18
+
19
+ # URI examples: "neo4j://localhost", "neo4j+s://xxx.databases.neo4j.io"
20
+ URI = "{neo4j-database-uri}"
21
+ AUTH = ("<Username>", "<Password>")
22
+
23
+ with GraphDatabase.driver(URI, auth=AUTH) as driver:
24
+ driver.verify_connectivity()
25
+ ----
You can’t perform that action at this time.
0 commit comments