Updated on 2023-08-31 GMT+08:00

Debugging the Sample Application in Windows

You can run the applications in a Windows development environment. If the local and cluster service planes can communicate with each other, you can debug the application on the local host.

  • If the IBM JDK is used in the Windows environment, the application cannot run in the Windows environment.
  • You need to set the one-on-one mapping between the host names and IP addresses of the access nodes in the hosts file on the local host where you run the sample code.
  • Only the JDBC sample program can run in the local Windows environment.

Procedure

  1. Compile the JDBC sample program.

    Click Terminal in the lower left corner of the IDEA page to access the terminal. Run the mvn clean package command to perform compilation.

    If "BUILD SUCCESS" is displayed, the compilation is successful. A JAR file containing the -with-dependencies field is generated in the target directory of the sample project.

  2. Run the JDBC sample program.

    • Run the JDBC sample project using the Windows command line interface.
      1. Create a directory on Windows as the running directory, for example, D:\jdbc_example. Save the JAR packages whose names contain -with-dependencies generated in 1 in the target directory to this directory. Create the src/main/resources subdirectory in the directory and copy all files in the hive-jdbc-example\src\main\resources directory obtained in Configuring and Importing the JDBC/HCatalog Sample Project to the src/main/resources directory.
      2. Run the JAR package.

        cd /d d:\jdbc_example

        java -jar hive-jdbc-example-1.0-SNAPSHOT-jar-with-dependencies.jar

        The preceding JAR file name is for reference only. Replace it with the actual one.

      3. View the HiveQL query results of the sample code in the command line interface. If the following information is displayed, the execution is successful.
        Create table success!
        _c0
        0
        Delete table success!
    • Run the JDBC sample project in IntelliJ IDEA.
      1. Right-click the JDBCExample class of the jdbc-examples project of IntelliJ IDEA and choose Run JDBCExample.main() from the shortcut menu.

      2. In the output window, view the HiveQL query result of the sample code. The following information is displayed:
        Create table success!
        _c0
        0
        Delete table success!