DBeaver is a universal database client. It connects to a database through the Java Database Connectivity (JDBC) driver provided by this database. It supports normal relational databases, non-relational databases, and distributed databases.
You can connect to a MySQL tenant of OceanBase Database by using the OceanBase or MySQL driver that comes with DBeaver. This topic describes how to connect to a MySQL tenant of OceanBase Database by using the OceanBase driver of DBeaver.
Prerequisites
You have downloaded and installed DBeaver. You can download the DBeaver installation package for your operating system from the DBeaver Community website.
The IP address of the OBServer node to be connected has access to the server where DBeaver is installed.
You have installed OceanBase Database and created a MySQL tenant.
Procedure
Step 1: Obtain the database connection string
Contact the deployment personnel or administrator of OceanBase Database to obtain the connection string. The following is a connection string example:
obclient -h$host -P$port -u$user_name -p$password -D$database_name
where:
$hostspecifies the IP address for connecting to OceanBase Database. It is the IP address of OceanBase Database Proxy (ODP) for connection through ODP, or the IP address of an OBServer node for direct connection.$portspecifies the port for connecting to OceanBase Database. For connection through ODP, the default value is2883, which can be customized when ODP is deployed. For direct connection, the default value is2881, which can be customized when OceanBase Database is deployed.$database_namespecifies the name of the database to be accessed.Notice
The user for connecting to a tenant must have the
CREATE,INSERT,DROP, andSELECTprivileges on the database. For more information about user privileges, see Privilege types in MySQL mode.$user_namespecifies the tenant account. Two formats are supported in the case of connection through ODP:username@tenant name#cluster nameandcluster name:tenant name:username. In the case of direct connection, the format isusername@tenant name.$passwordspecifies the password of the account.
For more information about the connection string, see Connect to an OceanBase Database tenant by using OBClient.
Here is an example:
obclient -hxxx.xxx.xxx.xxx -P2881 -utest_user001@mysql001 -p****** -Dtest
Step 2: Connect to OceanBase Database from the DBeaver console
Notice
The GUI of DBeaver varies based on the product versions. This topic describes how to connect to OceanBase Database by using DBeaver V22.0.5. For more information about the operations in other versions, see DBeaver documentation of the corresponding versions.
(Optional) Replace the driver file.
The default driver file for the OceanBase driver of DBeaver is
mysql-connector-java-5.1.44. This topic takesmysql-connector-java-5.1.47as an example. You can replace the driver file based on the following steps.Go to the MySQL Product Archives page on the official website of MySQL, choose version 5.1.47, and download the corresponding driver file.
Choose Database > Driver Manager, search for OceanBase, select the OceanBase driver, and then click Edit to go to the driver editing page.
Click the Libraries tab, select the driver file of the OceanBase driver, and then click Delete.
Click Add File to add the downloaded driver file to the library and then click OK.
Choose Database > New Database Connection to go to the Select your Database page. You can also click the
icon under File to go to the Select your database page.On the Select your database page, select OceanBase and click Next. On the Connection settings page, specify the information about the database to be connected and click Test Connection.
Notice
You can connect to OceanBase Database by using an IP address or ODP. When you use an IP address, enter the port number specified by the
mysql_portparameter. The default port number is2881. When you use ODP, enter the port number specified by theproxy_portparameter. The default port number is2883.If Connected is displayed in the Test Connection pop-up window, the database can be connected. Click OK and then click Finish.
Double-click the database name on the Database Navigator tab. If the database instances appear under the database, you have connected to OceanBase Database.
More information
For any problems encountered when you connect to OceanBase Database by using DBeaver, see related information in DBeaver Documentation.