You must configure the Java Database Connectivity (JDBC) URL of MaxCompute Lightning before you can connect an SQL client to MaxCompute Lightning.

  • JDBC URL format
    jdbc:postgresql://Endpoint:port/project_name[?ssl=true][&prepareThreshold=0][&preferQueryMode=simple][&user=UserName][&password=PassWord]
  • Parameters
    Parameter Value Description
    Endpoint The endpoint that is used to access MaxCompute Lightning. Select an endpoint based on your network environment and region. For example, if you want to access MaxCompute Lightning in the China (Shanghai) region over the Internet, set the endpoint to lightning.cn-shanghai.maxcompute.aliyun.com. For more information, see Endpoints.
    port The port number that is used to access MaxCompute Lightning. Example: 443. None.
    project_name The name of the MaxCompute project. You can log on to the MaxCompute console and view the name of the MaxCompute project on the Projects tab.
    user The AccessKey ID. The AccessKey ID of your Alibaba Cloud account or a RAM user within the Alibaba Cloud account. You can obtain the AccessKey ID from the Security Management page.
    password The AccessKey secret. The AccessKey secret that corresponds to the AccessKey ID. You can obtain the AccessKey secret on the AccessKey Management page.
    ssl Specifies whether to connect to MaxCompute Lightning by using Secure Sockets Layer (SSL). Example: true. By default, SSL is enabled on the MaxCompute Lightning server. Therefore, you must enable SSL on the client to connect to MaxCompute Lightning.
    prepareThreshold The number of PreparedStatement executions required before the JDBC driver switches over to use server-side prepared statements. Example: 0. Optional. If you use the PreparedStatement feature of JDBC, we recommend that you set prepareThreshold to 0.
    preferQueryMode Specifies which mode is used to run queries. Example: simple. Optional. If you specify filter conditions to filter out unnecessary partitions in PreparedStatement, we recommend that you set this parameter.
  • Examples
    • Example 1: The AccessKey ID and the AccessKey secret are not configured in the JDBC URL.
      jdbc:postgresql://lightning.cn-shanghai.maxcompute.aliyun.com:443/myproject?ssl=true
      Note In addition to the preceding configurations in the JDBC URL, you also need to specify the user and password parameters before you can connect to MaxCompute Lightning. You can also add the parameters to the JDBC URL to connect to MaxCompute Lightning. For more information, see Example 2.
    • Example 2: The AccessKey ID and the AccessKey secret are configured in the JDBC URL.
      jdbc:postgresql://lightning.cn-shanghai.maxcompute.aliyun.com:443/myproject?ssl=true&user=Tom&password=******