百度智能云

All Product Document

          Time-Spatial Database

          TsdbClient Create a TsdbClient

          Users can create a TsdbClient by referring to the following code:

          HTTP Client

          String ACCESS_KEY_ID = <your-access-key-id>;               // User's Access Key ID
          String SECRET_ACCESS_KEY = <your-secret-access-key>;       // User's Secret Access Key
          String ENDPOINT = <your-tsdb-database-endpoint>;           // User's Time Series Database ( TSDB) domain name, with the format such as databasename.tsdb.iot.gz.baidubce.com
           
          // create the configuration
          BceClientConfiguration config = new BceClientConfiguration()
                          .withCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY))
                          .withEndpoint(ENDPOINT);
           
          // Initialize a TsdbClient
          TsdbClient tsdbClient = new TsdbClient(config);

          HTTPS Client

          String ACCESS_KEY_ID = <your-access-key-id>;               // User's Access Key ID
          String SECRET_ACCESS_KEY = <your-secret-access-key>;       // User's Secret Access Key
          String ENDPOINT = <your-tsdb-database-endpoint>;           // User's Time Series Database ( TSDB) domain name, with the format such as databasename.tsdb.iot.gz.baidubce.com
           
          // create the configuration
          BceClientConfiguration config = new BceClientConfiguration()
                          .withProtocol(Protocol.HTTPS)              // Use HTTPS Protocol; If not set, use HTTP Protocol by default
                          .withCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY))
                          .withEndpoint(ENDPOINT);
           
          // Initialize a TsdbClient
          TsdbClient tsdbClient = new TsdbClient(config);

          In the above code, the variables ACCESS_KEY_ID and SECRET_ACCESS_KEY are assigned to the user by the system and are both strings used to identify the user and perform signature verification for accessing TSDB. Among them, ACCESS_KEY_ID corresponds to "Access Key ID" in the console, and SECRET_ACCESS_KEY corresponds to "Access Key Secret" in the console. Please refer to [Get](Reference/Get AKSK/How to Get AKSK.md)AK/SK for obtaining methods.

          Parameter Instruction

          There are more configuration items in BceClientConfiguration, and the following parameters can be configured:

          Parameters Instruction
          connectionTimeoutInMillis Set up timeout for connection (in milliseconds)
          localAddress Local Address
          maxConnections Max HTTP Connections allowed to open
          protocol Protocol type
          proxyDomain Windows domain name of the proxy server that accesses NTLM authentication
          proxyHost Proxy Server Host Address
          proxyPassword Password for proxy server verification
          proxyPort Proxy Server Port
          proxyPreemptiveAuthenticationEnabled Whether proxy preemptive authentication is enabled
          proxyUsername User name for proxy server verification
          proxyWorkstation Windows work station of the NTLM proxy server
          retryPolicy Retry Policy
          socketBufferSizeInBytes Socket Buffer Size in Bytes
          socketTimeoutInMillis Timeout of data transmission in open connections (in milliseconds)
          userAgent User Agent, User-Agent header of HTTP
          Previous
          Getting Started
          Next
          Write Operation