Article source: https://www.yingsoo.com/news/database/71844.html
Article directory
introduction
As a developer, it is inevitable to deal with databases, so we need a convenient database management tool. For a long time, Navicat has been my first choice, but recently I replaced a new computer, and the previous green installation package could not be found.
So I thought about finding a free database management tool with the same functions as Navicat to replace it. My good friend macrozheng recommended DBeaver to me. After the trial, the experience is really good, so I am here to give you a wave of Amway.
1. About DBeaver
DBeaver is a cross-platform database management tool that supports Windows, Linux and macOS. It has two versions, Enterprise Edition and Community Edition. For individual developers, the Community Edition is powerful enough.
DBeaver is written in Java and compiled with JDK 11 by default. The community edition is open-sourced on GitHub based on the Apache-2.0 License, and has currently received 24k+ stars.
https://github.com/dbeaver/dbeaver
DBeaver supports almost all mainstream databases, including relational and non-relational databases.
2. Install DBeaver
You can download the installation package through DBeaver official, or you can download the release version through GitHub.
Official download link: https://dbeaver.io/download/
Download the corresponding installation package according to your computer's operating system. After the complete installation, the first step is to configure the Maven mirror, otherwise the subsequent download of the database driver will be very slow.
Because DBeaver is built based on Maven, the database driver, that is, the JDBC driver connected to the database, is downloaded through the Maven repository. Select "Preferences" → "Maven" to add the Alibaba Cloud mirror address:
https://developer.aliyun.com/mvn/guide
It is the same as configuring the Maven image, as shown in the figure below.
After the configuration is complete, remember to set the Alibaba Cloud mirror warehouse to the top.
3. Manage data sources
Like using Navicat, we need to establish a connection first, here we take MySQL as an example. Click the "Connect" icon and select the database.
Click Next, then you need to fill in the database connection information.
Click "Test Link", if you use the default Maven warehouse, the download driver will be very slow, as shown in the figure below, and it is easy to fail "Don't step on the pit you have stepped on".
If you have configured Alibaba Cloud’s Maven image as I said earlier, the procedure will be different. Click “Test Link”, and a prompt box “Connection Successful” will pop up instantly.
After the link is successful, you can see the tables, views, indexes, etc. in the database.
4. Management table
After the database connection is successful, the most important thing is to operate the table.
01. View table
Select a table, double-click to see the properties of the table, you can view the table's columns, constraints (primary key), foreign keys, indexes and other information.
Click "DDL (Data Definition Language, Data Definition Language)" to see the detailed table creation statement.
Click "Data" to view the data of the table, and there are row operation buttons such as "Add", "Modify", and "Delete" at the bottom.
You can fill in the filter conditions in the filter box at the top, and then query the results directly.
If you don't want to display a certain column, you can directly click on the "Custom Result Set" chart and set the status of a field to invisible.
02. Add table
Select "Table" on the left, then right-click and select "New Table" to create a table id.
After that, right-click in the column area on the right and select "New Column" to add a field.
For example, we create a new primary key ID, as shown in the figure below.
In DBeaver, [v]
means true, []
means no. Then select ID in "Constraints" and set it as the primary key.
Finally, click Save, and a preview box of the table creation statement will pop up. Click "Execute" to complete the creation of the table.
5. Execute SQL
Right-click the database table and select "SQL Editor" in the right-click menu to open the SQL editing panel.
Then edit the SQL statement and click the small icon to run to query the data. There will be grammar prompts during this process, which is very nice.
A very eye-catching operation of DBeaver is that you can directly select a result set, and then right-click to generate SQL.
For example, the insert statement, which is very convenient when inserting a piece of repetitive content.
6. Appearance configuration
You can set the appearance in the preferences, for example, modify the theme to dark black.
Then the interface becomes a dark system.
You can also set the font size, etc.
From the point of view of the overall style, DBeaver is somewhat similar to Eclipse, which is true in fact. DBeaver is built on the Eclipse platform.
7. Summary
Generally speaking, DBeaver is a very good open source database management tool with comprehensive functions, which is basically enough for daily development. Comparing the paid Navicat and DataGrip, it can be said to be very conscientious. If you encounter a time when the paid version cannot be used, you can experience the community version of DBeaver.
This article has been included in GitHub https://github.com/itwanger/toBeBetterJavaer
The above is the detailed content of DBeaver to operate all database management tools. For more information about DBeaver database operation tools, please pay attention to other related articles on this site!