Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Step 6: Log In to the DDM Instance or Schema

Updated on 2022-12-08 GMT+08:00

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.

Preparations

Before login to your DDM instance or schema, you have to obtain the connection address of your DDM instance or schema.

Obtaining the Instance Connection Address

  1. Log in to the management console.
  2. Hover on the left menu to display Service List and choose Database > Distributed Database Middleware.
  3. In the navigation pane, choose Instances. In the instance list, locate the required instance and click its name.
  4. In the Network Information area, view the connection address.


    NOTE:

    If you enter an incorrect password for five times or more when attempting to access your DDM instance, the system will be locked for 20 minutes.

Obtaining the Schema Connection Address

  1. Log in to the management console.
  2. Hover on the left menu to display Service List and choose Database > Distributed Database Middleware.
  3. In the navigation pane, choose Instances. In the instance list, locate the required DDM instance and click its name.
  4. In the navigation pane, choose Schemas.
  5. In the schema list, locate the required schema and click its name.
  6. At the Connection Address area, view the CLI and JDBC connection addresses.

    Figure 1 Schema connection address
    NOTE:

    If you enter an incorrect password for five times or more when attempting to access your DDM instance, the system will be locked for 20 minutes.

Connection Methods

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.

For details about method 4, see Log In to a DDM Instance on the DDM Console.

NOTE:
  1. For security purposes, use an ECS in the same VPC as your DDM instance.
  2. Ensure that a MySQL client has been installed on the required ECS or the MySQL connection driver has been configured.
  3. Before you log in to a DDM instance, configure its information on the client or connection driver.

Using Navicat to Log In to a DDM Instance

  1. Log in to the DDM console, locate the required DDM instance, and click its name.
  2. In the Instance Information area, click Bind and select an EIP available.
  3. In the left pane, click the VPC icon and choose Access Control > Security Groups.
  4. On the Security Groups page, locate the required security group and click Manage Rule in the Operation column. On the displayed page, click Add Rule. Configure the security group rule as needed and click OK.

    NOTE:

    After binding an EIP to your DDM instance, set strict inbound and outbound rules for the security group to enhance database security.

  5. Open Navicat and click Connection. In the displayed dialog box, enter the host IP address (EIP), username, and password (DDM account).
  6. Click Test Connection. If a message is returned indicating that the connection is successful, click OK. The connection will succeed 1 to 2 minutes later. If the connection fails, the failure cause is displayed. Modify the required information and try again.
NOTE:

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.

Using the MySQL CLI to Log In to a Schema

  1. Log in to the required ECS, open the CLI, and run the following command:

    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]
    Table 1 Parameter description

    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) Select character set UTF-8 for encoding.

    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

    The password authentication plug-in is used by default.

    -

    NOTE:

    If you use the MySQL 8.0 client, set default_auth to mysql_native_password.

  2. View the command output. The following is an example output of running a MySQL command in the Windows CLI.

    C:\Users\testDDM>mysql -h192.168.0.200 -P5066 -Ddb_5133 -udbuser01 -p
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
     
    Welcome to the MySQL monitor.  Commands end with ;or \g.
    Your MySQL connection id is 5
    Server version: 5.6.29
     
    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
     
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
     
    mysql>

Using a JDBC Driver to Log In to a Schema

  1. Load the required JDBC driver.

    Class.forname(com.mysql.jdbc.Driver);
    NOTE:

    JDBC drivers 5.1.35 to 5.1.45 are recommended.

  2. Create a database connection.

    String username = "dbuser01" ;
    String password = "xxxxxx" ; 
    String url = "jdbc:mysql://192.168.0.200:5066/db_5133";
    Connection con = DriverManager.getConnection(url , username , password);

  3. Create a Statement object.

    Statement stmt = con.createStatement();

  4. Execute the required SQL statement.

    ResultSet rs = stmt.executeQuery("select now() as Systemtime");
    con.close();

  5. (Optional) Optimize code as needed.

    loadBalanceAutoCommitStatementThreshold=5&loadBalanceHostRemovalGracePeriod=15000&loadBalanceBlacklistTimeout=60000&loadBalancePingTimeout=5000&retriesAllDown=10&connectTimeout=10000";
    NOTE:
    • Parameters loadBalanceAutoCommitStatementThreshold and retriesAllDown must be configured based on the example in 5. Otherwise, an infinite loop may occur during the connection switchover, resulting in stack overflow.
    • loadBalanceAutoCommitStatementThreshold: defines the number of matching statements which will trigger the driver to potentially swap physical server connections.
    • loadBalanceHostRemovalGracePeriod: indicates the grace period to wait for a host being removed from a load-balanced connection, to be released when it is the active host.
    • loadBalanceBlacklistTimeout: indicates the time in milliseconds between checks of servers which are unavailable, by controlling how long a server lives in the global blacklist.
    • loadBalancePingTimeout: indicates the time in milliseconds that the connection will wait for a response to a ping operation when you set loadBalanceValidateConnectionOnSwapServer to true.
    • retriesAllDown: indicates the maximum number of connection attempts before an exception is thrown when a valid host is searched. SQLException will be returned if the threshold of retries is reached with no valid connections obtained.
    • connectTimeout: indicates the maximum amount of time in milliseconds that the JDBC driver is willing to wait to set up a socket connection. 0 indicates that the connection does not time out. Only JDK-1.4 or later is supported. The default value 0.

Log In to a DDM Instance on the DDM Console

  1. Log in to the DDM console.
  2. In the navigation pane, choose Instances.
  3. In the instance list, locate the required instance and click Log In in the Operation column.

    On the displayed page, enter the required username and password.

  4. On the displayed page, enter username and password of the DDM account.
  5. Click Test Connection.
  6. (Optional) Enable Collect Metadata Periodically and Show Executed SQL Statements.
  7. Ensure that all settings are correct and click Log In.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback