Obtaining and Installing the Java SDK
Obtaining DLI SDKs
On the DLI management console, download the SDK installation package dli-sdk-java-x.x.x.zip and extract it. The directory structure after extraction is shown in the table below.
You are advised to also download the .sha256 file from the SDK installation package, as it can be used to verify the integrity of the SDK package. For details about the verification method, see Verifying the Integrity of the SDK Package.
|
Parameter |
Description |
|---|---|
|
jars |
SDK and its dependent JAR packages. |
|
maven-install |
Script and JAR file that are installed in the local Maven repository. |
|
dli-sdk-java.version |
Java SDK version description. |
Verifying the Integrity of the SDK Package
When downloading the SDK installation package, you also need to download the .sha256 file to verify the integrity of the SDK package. This section outlines the steps to use the .sha256 file for verifying the integrity of the SDK package.
- Downloading files
- Find the download link of the .sha256 file on the page for downloading the SDK installation package.
Typically, the name of the .sha256 file is associated with the name of the SDK installation package. For example, if the name of the SDK installation package is dli-sdk-java-x.x.x, the corresponding .sha256 file may be dli-sdk-java-x.x.x.sha256.
- Download the SDK installation package and the .sha256 file separately to the local host, ensuring both files are saved in the same folder.
- Find the download link of the .sha256 file on the page for downloading the SDK installation package.
- Querying the SHA-256 hash value of the SDK installation package
- On Windows
- Search for cmd in the Start menu to open the command window.
- Run the cd command to go to the directory where the SDK installation package is saved.
For example, if the SDK installation package is saved in the SDK folder on drive D, enter cd D:\SDK.
- Run the following command:
certutil -hashfile <SDK-installation-package-name> SHA256
Replace <SDK-installation-package-name> with the actual SDK installation package name, for example, certutil -hashfile sdk - package.zip SHA256.
- After the command is executed, the command prompt will display the SHA-256 hash value of the SDK installation package.
- On Linux
- Run the cd command to go to the directory where the SDK installation package is saved.
For example, if the SDK installation package is saved in the SDK folder in the user's home directory, enter cd ~/SDK.
- Enter the query command:
sha256sum <SDK-installation-package-name>
Replace <SDK-installation-package-name> with the actual SDK installation package name, for example, sha256sum sdk - package.zip.
- After the command is executed, the terminal will display the SHA-256 hash value of the SDK installation package.
- Run the cd command to go to the directory where the SDK installation package is saved.
- On Windows
- Comparing hash values
- Open the downloaded .sha256 file using the text editor.
- Find the SHA-256 hash value of the SDK installation package in the .sha256 file.
It is typically a long string, for example, a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6xxxxxxxxxxxxxxxxxxxxxxxx.
- Compare the SHA-256 hash value of the SDK installation package obtained in Querying the SHA-256 hash value of the SDK installation package with the hash value in the .sha256 file.
- If the two hash values are identical, the SDK installation package was not altered during the download process and the file is intact.
- If the hash values are inconsistent, an error occurred during the download of the SDK installation package or that the file was maliciously modified.
In this case, you are advised to download the SDK installation package and its corresponding .sha256 file again and then verify the package.
Installing the SDK
- Method 1: Adding the SDK using the Maven central repository
The Maven central repository is part of the Apache Maven project that provides Java libraries and frameworks.
When the SDK retrieval method is not specified, the default approach is to add the SDK driver using the Maven central repository.
Use Maven to add the Maven configuration items on which huaweicloud-dli-sdk depends. (This is the default operation and does not need to be separately configured.)1 2 3 4 5
<dependency> <groupId>com.huawei.dli</groupId> <artifactId>huaweicloud-dli-sdk-java</artifactId> <version>x.x.x</version> </dependency>
- Method 2: Obtaining the SDK 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 SDK.
<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
- Log in to the DLI management console.
- Click SDK Download in the Common Links area on the right of the Overview page.
- On the DLI SDK DOWNLOAD page, select a driver and download it.
Click huaweicloud-dli-sdk-java-x.x.x to download a JDBC driver package.
The JDBC driver package is named huaweicloud-dli-sdk-java-<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.
- The downloaded JDBC driver package contains .bat (Windows) or .sh (Linux/Mac) scripts, which are used to automatically install the SDK 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot