# 3.2.6: DBeaver

## Learning Objectives

1. DBeaver is a universal database management tool that interfaces with multiple database systems, including PostgreSQL.&#x20;
2. DBeaver allows developers to interface with SQL database using a GUI, using this tool you can make alterations to the database, visualise table relationships and more.
3. Understand how to install and utilise DBeaver to interface with a PostgreSQL database on your machine.

## Installation

To install DBeaver please goto this [link](https://dbeaver.io/download/) and follow the installation instructions specific to your operating system. Once you have completed the installation you will be able to interface with your PostgreSQL database, provided it is currently running on your machine. With this in mind, you will have to connect to each database currently running on PostgreSQL if you want to interface with the database.

Open the DBeaver application and you should see something similar to the image below:

<figure><img src="/files/qDjerlL9VPRXgH2NQWGx" alt=""><figcaption><p>DBeaver Interface</p></figcaption></figure>

For detailed instructions on how to use this tool please refer to this [manual](https://dbeaver.com/doc/dbeaver.pdf).&#x20;

## Interfacing with your database&#x20;

To interface with your database you will need to configure your database connection, please follow the instructions below:&#x20;

1. Click on the "Database" menu and select "New Database Connection".
2. In the "Connection Type" dropdown menu select "PostgreSQL".
3. Fill in the required credentials, these should be the same credentials you use in Sequelize to interface with your database, the credentials include:
   1. Host. Eg: "localhost"
   2. Port. Eg: "5432"
   3. Database Name. Eg: "fruit"
   4. Username. Eg: "postgres"
   5. Password. Eg: ""
4. Now you can click the "Test Connection" button to verify that the connection is successful.&#x20;
5. Once tested click "Finish" to save this connection configuration.

## Managing your database with DBeaver

Once DBeaver has been installed and you have connected to your databases you will be able to explore your database structure, all you need to do is expand the connection. This is on the left side of the application.

<figure><img src="/files/1NTut6TWbysFV0b2YUgd" alt="" width="275"><figcaption><p>Navigation DBeaver</p></figcaption></figure>

From here you can select a database and choose to look at the "Properties" or "ERD". This is on the right side of the application.

<figure><img src="/files/4OHmJsvY4JdCDUljMN8G" alt=""><figcaption><p>DBeaver Table Schema</p></figcaption></figure>

Within "Properties" you can see the table schemas and even the data currently residing in your tables.

If you click on ERD on the otherhand, an image like below will appear:

<figure><img src="/files/63ctdILHSYA8wtZmMKGB" alt=""><figcaption><p>DBeaver ERD</p></figcaption></figure>

## Data Manipulation

Using DBeaver  you are able to select individual tables such that you can manipulate the data stored within. To do this use the editor portion of the application, and tool bar at the bottom of the page. This affords developers an easier way to manage data instead of interfacing with PostgreSQL using just the CLI.&#x20;

<figure><img src="/files/OpDP1vVLhxYinFXYjpXN" alt=""><figcaption><p>Where to edit your table</p></figcaption></figure>

### Data Transfer

Another helpful feature of DBeaver is data transfer, this is crucial such that you can export and import data in various formats as well as transferring data between tables within the same or to other databases. Exporting data is rather simple but when you're trying to import data there are a few more steps. If you are interested in attempting this follow this [guide](https://dbeaver.com/docs/dbeaver/Data-transfer/).

It should be noted, at Rocket Academy we suggest utilising Sequelize Migrations and Seeders to setup the database, this means that importing data using DBeaver isn't what we suggest. It should be noted you can construct Seeder files using NodeJs's inbuilt module [fs](https://nodejs.org/api/fs.html) and [csv-reader](https://www.npmjs.com/package/csv-reader) or [csv-parser](https://www.npmjs.com/package/csv-parser). If you would like to explore this style of seed development you can use this [article](https://stackoverflow.com/questions/44912892/how-to-easily-parse-csv-file-to-use-in-node-js-sequelize-database-migration-stra) as a reference point, you may need to alter the code to suit your table structure.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bc.rocketacademy.co/3-backend/3.2-sql/3.2.6-dbeaver.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
