tencent cloud

TDSQL Boundless

Release Notes
Product Introduction
Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Kernel Features
Kernel Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Billing
Billing Overview
Purchase Method
Pricing Details
Renewal
Overdue Payments
Refund
Getting Started
Creating an Instance
Connect to Instances
User Guide
Data Migration
Data Subscription
Instance Management
Configuration Change
Parameter Configuration
Account Management
Security Group
Backup and Restoration
Database Auditing
Tag Management
Use Cases
Technical Evolution and Usage Practices of Online DDL
Lock Mechanism Analysis and Troubleshooting Practices
Data Intelligent Scheduling and Related Practices for Performance Optimization
TDSQL Boundless Selection Guide and Practical Tutorial
Developer Guide
Developer Guide (MySQL Compatibility Mode)
Developer Guide (HBase Compatibility Mode)
Performance Tuning
Performance Tuning Overview
SQL Tuning
DDL Tuning
Performance White Paper
Performance Overview
TPC-C Test
Sysbench Test
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Security Group APIs
Task APIs
Backup APIs
Rollback APIs
Parameter APIs
Database APIs
Data Types
Error Codes
General Reference
System Architecture
SQL Reference
Database Parameter Description
TPC-H benchmark data model reference
Error Code Information
Security and Compliance
FAQs
Agreements
Service Level Agreement
Terms of Service
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Connecting to the Database

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-02-10 10:54:56

Prerequisites

An instance in HBase-compatible mode has been created.
The related data tables and database users have been created.

Step 1: Add Client Dependencies

Add jar package dependencies to the pom.xml file of your local Java project.
<dependency>
<groupId>com.tencent.tdsql</groupId>
<artifactId>tdsql-hbase-shaded-client</artifactId>
<version>1.0.9</version>
</dependency>
Note:
Version update: It is recommended to use the latest version of the jar package, as older versions may not support the new server.
Version check: Refer to the published tdsql-hbase-shaded-client version in the central repository and replace the version number with the latest published version number.

Step 2: Configure Client Connection Parameters

public class HBaseInsertDemo {
public static void main(String[] args) throws Exception {
// Configure HBase
Configuration conf = HBaseConfiguration.create();
config.set("hbase.client.tdsql.quorum", "10.10.10.10:6752"); // HBase service RPC port
config.setBoolean("hbase.tdsql.hash.partition", Boolean.TRUE); // Enable HBase compatible mode
config.set("mysql.native.username", "test"); // Database username
config.set("mysql.native.password", "test123"); // Database password

Connection connection = ConnectionFactory.createConnection(conf);

// Get the Table handle
TableName tableName = TableName.valueOf("ht1");
Table table = connection.getTable(tableName);

// Prepare to insert data
Put put = new Put(Bytes.toBytes("rk801"));
put.addColumn(Bytes.toBytes("cf1"), Bytes.toBytes("column1"), Bytes.toBytes("v1")); // Column family, column qualifier, value
table.put(put);

// Disable resources.
table.close();
connection.close();

System.out.println("Data inserted successfully!");
}
}
Parameter description:
Parameter
Description
hbase.client.tdsql.quorum
HBase service RPC port.
hbase.tdsql.hash.partition
Must be set to TRUE to enable HBase compatible mode.
mysql.native.username
As with MySQL, you can set it via SQL statements for creating users, ignoring MySQL privileges.
mysql.native.password

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백