このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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

Downloading and Installing the JDBC Driver Package

Updated on 2025-01-10 GMT+08:00

Scenario

To connect to DLI, JDBC is utilized. You can obtain the JDBC installation package from Maven or download the JDBC driver file from the DLI management console.

This section describes how to connect to DLI and submit a SQL job using JDBC.

Obtaining the Server Connection Address

The address for connecting to DLI is in the format of jdbc:dli://<endPoint>/<projectId>. So, you need to obtain the endpoint and project ID.

Obtain the DLI endpoint from Regions and Endpoints. Specifically, log in to the public cloud, hover over your username in the upper right corner, and choose My Credentials from the shortcut menu. You can obtain the project ID on the displayed API Credentials tab page.

Downloading and Installing the JDBC Driver

NOTE:

Once JDBC 2.X has undergone function reconstruction, query results can only be accessed from DLI job buckets. To utilize this feature, certain conditions must be met:

  • On the DLI management console, choose Global Configuration > Project to configure the job bucket.
  • Starting May 2024, new users can directly use DLI's function to write query results into buckets without needing to whitelist it.

    For users who started using DLI before May 2024, to use this function, they must submit a service ticket to whitelist it.

  • Method 1: Adding the JDBC driver using the Maven central repository

    The Maven central repository is part of the Apache Maven project that provides Java libraries and frameworks.

    When the JDBC retrieval method is not specified, the default approach is to add the JDBC driver using the Maven central repository.

    Use Maven to add the Maven configuration item on which huaweicloud-dli-jdbc depends. (This is the default operation and does not need to be configured separately.)
    1
    2
    3
    4
    5
     <dependency>
        <groupId>com.huawei.dli</groupId>
        <artifactId>huaweicloud-dli-jdbc</artifactId>
        <version>x.x.x</version>
     </dependency>
    
  • Method 2: Obtaining the JDBC driver using Maven to configure the Huawei image source

    When using Maven to manage project dependencies, you can modify the settings.xml file to configure the Huawei image source to obtain the JDBC driver.

    <mirror>
        <id>huaweicloud</id>
        <mirrorOf>*</mirrorOf>
        <url>https://mirrors.huaweicloud.com/repository/maven/</url>
    </mirror>
  • Method 3: Downloading the JDBC driver file from the DLI management console
    1. Log in to the DLI management console.
    2. Click SDK Download in the Common Links area on the right of the Overview page.
    3. On the DLI SDK DOWNLOAD page, select a driver and download it.

      Click huaweicloud-dli-jdbc-x.x.x to download a JDBC driver package.

      NOTE:

      The JDBC driver package is named huaweicloud-dli-jdbc-<version>.zip. It can be used in all versions of all platforms (such as Linux and Windows) and depends on JDK 1.7 or later.

    4. The downloaded JDBC driver package contains .bat (Windows) or .sh (Linux/Mac) scripts, which are used to automatically install the JDBC driver to the local Maven repository.
      You can choose a script based on your OS to install the JDBC driver.
      • Windows: Double-click the .bat file or run the file in the CLI.
      • Linux/Mac: Run the .sh script.

Authentication

You need to be authenticated when using JDBC to create DLI driver connections.

JDBC currently supports two authentication modes: AK/SK-based and token-based. Token-based authentication is only supported by dli-jdbc-1.x. AK/SK-based authentication is recommended.
  • (Recommended) Generating an AK/SK
    1. Log in to the DLI management console.
    2. Hover over the username in the upper right corner and select My Credentials from the shortcut list.
    3. The Projects area is displayed on the API Credentials tab page by default. Choose Access Keys in the navigation pane on the left.
    4. Click Create Access Key. In the dialog box that appears, set Login Password and SMS Verification Code.
    5. Click OK to download the certificate.
    6. Once the certificate is downloaded, you can obtain the AK and SK information in the credentials file.
    NOTE:

    Hard coding AKs and SKs or storing them in code in plaintext poses significant security risks. You are advised to store them in encrypted form in configuration files or environment variables and decrypt them when needed to ensure security.

  • Obtaining a token

    When using token-based authentication, you need to obtain the user token and configure the token information in the JDBC connection parameters. You can obtain the token as follows:

    1. Send POST https://<IAM_Endpoint>/v3/auth/tokens. To obtain the IAM endpoint and region name in the message body, see Regions and Endpoints.
      Here is an example request:
      NOTE:

      Replace the content in italic in the sample code with the actual values. For details, see Identity and Access Management API Reference.

      {
        "auth": {
          "identity": {
            "methods": [
              "password"
            ],
            "password": {
              "user": {
                "name": "username",
                "password": "password",
                "domain": {
                  "name": "domainname"
                }
              }
            }
          },
          "scope": {
            "project": {
              "id": "0aa253a31a2f4cfda30eaa073fee6477" //Assume that project_id is 0aa253a31a2f4cfda30eaa073fee6477.
            }
          }
        }
      }
    2. After the request is processed, the value of X-Subject-Token in the response header is the token value.

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