After you create a DDM instance, you can log in to it using a client such as Navicat, or connect to the required schema in the instance using the CLI or JDBC driver.
This section describes how to log in to a DDM instance or a schema.
Before you log in to your DDM instance or schema, you have to obtain its connection address.
Alternatively, locate the target schema, click its name to go to the Basic Information page. In the Connection Address tab page, obtain connection addresses for CLI and JDBC.
For details about method 1, see Using Navicat to Log In to a DDM Instance.
For details about method 2, see Using the MySQL CLI to Log In to a Schema.
For details about method 3, see Using a JDBC Driver to Log In to a Schema.
After binding an EIP to your DDM instance, set strict inbound and outbound rules for the security group to enhance database security.
Navicat12 is recommended for Navicat clients.
Using Navicat to access a DDM instance is similar to using other visualized MySQL tools such as MySQL Workbench. Therefore, the procedure of using other visualized MySQL tools to connect to a DDM instance has been omitted.
mysql -h ${DDM_SERVER_ADDRESS} -P${DDM_SERVER_PORT} -u${DDM_USER} -p [-D${DDM_DBNAME}] [--default-character-set=utf8][--default_auth=mysql_native_password]
Example Parameter | Description | Example Value |
|---|---|---|
DDM_SERVER_ADDRESS | IP address of the DDM instance | 192.168.0.200 |
DDM_SERVER_PORT | Connection port of the DDM instance | 5066 |
DDM_USER | Account of the DDM instance | dbuser01 |
DDM_DBNAME | (Optional) Name of the target schema in the DDM instance | - |
default-character-set=utf8 | (Optional) UTF-8 character encoding system Configure this parameter if garbled characters are displayed during parsing due to inconsistency between MySQL connection code and actually used code. | - |
default_auth=mysql_native_password | (Optional) Password authentication plug-in used by default | - |
C:\Users\testDDM>mysql -h192.168.0.200 -P5066 -Ddb_5133 -udbuser01 -pEnter password:Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor. Commands end with ;or \g.Your MySQL connection id is 5Server version: 5.6.29Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
To perform the following operations, install the JDBC driver of 5.1.49 or later versions. JDBC driver download address: https://dev.mysql.com/doc/index-connectors.html.
Class.forname(com.mysql.jdbc.Driver);
String username = "EXAMPLE_USERNAME_ENV" ;String password = "EXAMPLE_PASSWORD_ENV" ;String url = "jdbc:mysql://ip:port/db_name";Connection con = DriverManager.getConnection(url , username , password);
For details, see the example parameter value in Table 2.
Parameter | Description | Example Value |
|---|---|---|
ip:port | Indicates the connection address and port number for connecting to the DDM instance. | 192.168.0.200:5066 See Obtaining the Schema Connection Address to obtain the JDBC connection address and port number. |
db_name | Indicates the name of a schema. | db_5505 On the DDM console, locate the required instance and click its name. In the navigation pane on the left, choose Schemas to view the schema name. |
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select now() as Systemtime");con.close();
loadBalanceAutoCommitStatementThreshold=5&loadBalanceHostRemovalGracePeriod=15000&loadBalanceBlacklistTimeout=60000&loadBalancePingTimeout=5000&retriesAllDown=10&connectTimeout=10000&useSSL=true";
Parameter | Description | Example Value |
|---|---|---|
loadBalanceAutoCommitStatementThreshold | Indicates the number of statements executed before a reconnection.
When automatic submission is disabled (autocommit is set to false), the system waits for the transaction to complete and then determines whether to initiate a reconnection. | 5 |
loadBalanceHostRemovalGracePeriod | Indicates the grace period to wait for a host being removed from a load balancing connection, and to be released when it is the active host. | 15000 |
loadBalanceBlacklistTimeout | Indicates the time in milliseconds between checks of servers which are unavailable, by controlling how long a server lives in the global blacklist. | 60000 |
loadBalancePingTimeout | Indicates the time in milliseconds for waiting for the ping response of each load balancing connection. | 5000 |
retriesAllDown | Indicates the maximum number of polling retries when all connection addresses fail. SQLException will be returned if the threshold of retries is reached with no valid connections obtained. | 10 |
connectTimeout | Indicates the timeout interval for establishing a socket connection with a database server. Unit: millisecond. A value of 0 indicates that connection establishment never times out. This parameter setting is used for JDK 1.4 or later versions. | 10000 |
socketTimeout | Indicates the timeout interval for a socket operation (read and write). Unit: millisecond. A value of 0 indicates that a socket operation never times out. | Set this parameter based on your service requirements. |
useSSL | Indicates whether an SSL connection is used to connect to DDM. | true |