Data Director
Cross-Platform Database Management with DBeaver
Save time and effort as you rummage through large quantities of data.
Special Thanks: This article was made possible by support from Linux Professional Institute
Governing and taking care of databases is a specialized task that requires special system administrators who are commonly known as Database Administrators (DBAs). While their role encompasses all aspects of maintaining data integrity within an organization, some of it overlaps with the duties of a system administrator.
To save yourself time and effort when you are called to administer databases, you can use a graphical database management tool. There’s no dearth of such tools, and some databases have their own in-house versions. What sets DBeaver apart is that it works across platforms and supports a wide variety of database servers. Whether you are using relational databases like PostgreSQL and MariaDB, Hadoop-based ones like Apache Hive, graph databases like Neo4j, or even embedded ones like Firebird and SQLite, DBeaver can manage them all as well as several others (Figure 1). Basically if your database server has a JDBC driver, you can hook it up with DBeaver.
DBeaver comes in two versions: DBeaver Community Edition (CE) and DBeaver Enterprise Edition (EE). The CE version discussed in this article is available under the open source Apache License. The proprietary DBeaver EE is available under a subscription model and additionally supports databases with non-JDBC drivers, including NoSQL behemoths like MongoDB and Apache Cassandra. Refer to the “Enterprise Edition Features” box for information on the functionality you get with the proprietary version.
Enterprise Edition Features
While the open source CE version has plenty of features, it lacks some that make more sense in a data-intensive enterprise. For starters, there’s the Mock Data generator, a very useful feature for populating a newly created database with thousands of rows of sample data. If you have a large database and complex relationships between the tables, you can use the Visual Query Builder tool. It’s designed to aid even non-SQL users by helping them query the database without writing a single line of SQL.
Furthermore, DBeaver has tools that’ll help you keep an eye on interactions with the database server and even optimize it to be more efficient. There’s the Session Manager tool that monitors connections to the database and will pinpoint sessions that consume too many resources. There’s also the Execution Plan Analyzer, which is part of the Session Manager tool and helps dig out inefficient queries.
You can use DBeaver CE for a variety of common tasks such as editing metadata, exporting/importing data, managing users, and a lot more. It includes an SQL Editor, a query manager, and Entity Relation (ER) diagrams, which help visualize the connections between the databases. You can also use DBeaver to easily manipulate the data housed inside the database by directly viewing and editing it.
DBeaver is written in Java and based on the Eclipse Rich Client Platform. DBeaver CE is available in the repositories of many distributions. I use Ubuntu, and the Snap version in the repositories is outdated, so I suggest grabbing one from Flathub. To equip Ubuntu to install Flatpak’s, first fetch the Flatpak plugin for Gnome Software with:
sudo apt install gnome-software-plugin-flatpak
This will automatically install all the required components. Once it’s done, add the Flathub repository with:
sudo flatpak remote-add --if-not-exists flathub
Your Ubuntu installation is all set to install Flatpak apps now. If you aren’t running Ubuntu, follow the instructions for your distribution on the Flatpak website to enable it to install flatpaks. Once your distribution is ready, you can search for DBeaver inside its graphical software manager or type
flatpak install flathub io.dbeaver.DBeaverCommunity
inside a terminal to install the app.
Initial Impressions
When you launch DBeaver for the first time, it will prompt you for details to connect to a database server. The first step is to select a database server to which you wish to connect from the list of supported databases. You can use DBeaver to connect to databases on the localhost, as well as those on a remote machine over the network or across the Internet. Different databases require different configurations, but, generally speaking, you’ll need to enter the database server's hostname and its administrator user's username and password (Figure 2). You should use the Test Connection option to check the connection before exiting the wizard. Since this is a pristine installation, DBeaver will download the drivers it requires to communicate with your database.
Once it connects to the database server, DBeaver will take you to the main interface. Every connection you create shows up in the Database Navigator tab on the left. It shows an expandable tree, which you can use to access the various database components, such as its tables, indexes, views, and more.
You can double-click on any component to load it in the Editor window on the right and then manipulate it. For instance, double-click on a table to load in the Editor window. This will open the table in three tabs (Figure 3). The first tab, Properties, displays various bits of information about the table. The second tab, Data, displays the actual data within the table. Finally, the ER Diagram tab displays the entity relation between the various tables. This tab is more useful when viewing an entire database as it displays the foreign keys that link the various tables.
Spend some time exploring DBeaver’s interface. The app has very powerful and useful right-click context menus in the navigation window that offer all kinds of functionality. Right-click on a table to create a new one or even an entire database. There are options to help you import and export data to and from a table (see the “Moving Data” box for details). If you select multiple tables, the menu also has an option to compare them on various parameters. One of the most useful options in the context menu is the Tools submenu that includes various helpful options. For instance, you can backup a database and analyze, repair, and optimize a table, in addition to other options. To help you write SQL queries, the menu also includes options to generate various kinds of SQL statements.
Moving Data
In addition to letting you connect to your database server and manipulate its structure and data, DBeaver also lets you import and export data. After you’ve established a connection to a database server, select a table and bring up the right-click context menu. The menu contains separate options to import and export data. Selecting either option launches the Data Transfer wizard, which assists you with the task. Using the Import Data option, you can bring in data into a table from a CSV file or from another table. The wizard will take you through the steps involved in importing the data depending on the file type from which you want to import it. On the other hand, if you wish to export the data, the wizard will first prompt you to select the file format for exporting the data. DBeaver supports various popular file formats including CSV, HTML, JSON, XLS, and more. It can even export the data as a series of SQL INSERT statements, which makes it easier to import the database.
Useful Functions
DBeaver has some very useful tools to ease many of the routine database administration tasks. One of the most useful ones is the SQL Editor, which has lots of features to ease writing SQL that you would expect from an IDE such as autocompletion, auto-formatting, templates, history, and more.
You can bring up the SQL Editor from the right-click context menu mentioned earlier, or by heading to SQL Editor | SQL Editor (Figure 4). Here you can write the SQL queries either manually with the help of autocomplete or use assistance tools like SQL Templates, which insert frequently used SQL statements. You can also use the Generate SQL option from the right-click context menu to copy and paste common SQL queries.
Once you’ve written a bunch of SQL statements, you can use the Play button on the left-side of the SQL Editor to run the currently selected statement. The query output will be displayed in the results window below the SQL Editor. What’s more, you can edit the values in the results window and even insert new rows of data. When you make any changes in the Data Viewer, before you save them to the database, you can use the Script button to preview the SQL lines that will make the actual changes to the database.
In fact, the Data Viewer is another interesting feature of DBeaver. Besides letting you edit data inside a table, you can also use it to filter, sort, and colorize the data. These features help make sense of large quantities of data. The top toolbar contains buttons that you can use to apply custom filters to sort the data depending on your needs. There are several ways you can filter the data. One of the easiest is to specify a SQL expression in the filter field above the table or pick one from the predefined templates.
ER diagrams (Figure 5) are the third important tool, for helping visualize the connections between the various tables in the database. ER diagrams in DBeaver are read-only; you can move the elements and rearrange their layout, but these changes cannot be saved. If you want to make any changes or add new elements, DBeaver lets you create custom ER diagrams via New | ER Diagram. This launches a wizard that prompts you to select the tables you want to include in the ER diagram; however, you can add more tables, even for different databases, once the initial diagram has been created. You can then use the diagram tools and add the connections you want between the tables.
As you can see, DBeaver is a very diverse tool that will make a DBA's life a lot simpler. The open source Community Edition supports a wide array of commonly-used databases and rolls in quite a lot of functionality to take the pain out of managing databases in all types of environments. The project has ample documentation on its wiki to help you orient yourself with the tool.
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.