To connect to ArangoDB, you typically use one of the available client drivers or APIs provided by ArangoDB for your programming language of choice. Here's a general guide on how to connect to ArangoDB using some common languages:
JavaScript (Node.js) : ArangoDB provides an official JavaScript driver called arangojs for Node.js. You can install it via npm:
Then, you can use it to connect to your ArangoDB instance:
const { Database } = require('arangojs');
const db = new Database({
url: 'http://localhost:8529',
databaseName: '_system', // or your specific database name
auth: { username: 'your_username', password: 'your_password' }
});
db.listCollections()
.then(collections => console.log(collections))
.catch(err => console.error('Failed to list collections:', err));?
Python : ArangoDB provides an official Python driver called python-arango. You can install it via pip:
pip install python-arango?
Then, you can use it to connect to your ArangoDB instance:
from arango import ArangoClient
client = ArangoClient(hosts='http://localhost:8529')
db = client.db('_system', username='your_username', password='your_password')
print(db.collections())?
Java : ArangoDB provides an official Java driver called arangodb-java-driver. You can include it in your Maven or Gradle project dependencies:
Maven :
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver</artifactId>
<version>7.16.0</version> <!-- Check for the latest version -->
</dependency>?
Gradle :
implementation 'com.arangodb:arangodb-java-driver:7.16.0' // Check for the latest version?
Then, you can use it to connect to your ArangoDB instance:
import com.arangodb.ArangoDB;
import com.arangodb.ArangoDatabase;
ArangoDB arangoDB = new ArangoDB.Builder().host("localhost", 8529).user("your_username").password("your_password").build();
ArangoDatabase db = arangoDB.db("_system");
System.out.println(db.getCollections());?
These are just examples for some commonly used programming languages. Depending on your specific use case and programming language, you can choose the appropriate client driver or library provided by ArangoDB. Make sure to replace "
localhost:8529", "
your_username", and "
your_password" with your actual ArangoDB server address, username, and password.