Baidu AI Cloud
中国站

百度智能云

Data Warehouse

CREATE-RESOURCE

CREATE RESOURCE

Description

Used to create a resource. Resources can be cited by other processes.

Currently the following resource types are supported:

  1. ODBC

    CREATE EXTERNAL RESOURCE `resource_name`
    [PROPERTIES]
    • PROPERTIES is used to set ODBC connection information.

      • type:resource type. Fixed content: odbc_catalog.
      • host/port:target of data source connection.
      • user/password:username and password for connecting data source.
      • database/table:Database and table names in the data source.

        When citing resources in CREATE ODBC TABLE, the information here can be covered by specifying the database and table names.

      • odbc_type:ODBC type, supporting:oracle,mysql and postgresql.
      • driver: ODBC Driver name. The public cloud users support: Oracle,MySQL and PostgreSQL.

Example

  1. Create an ODBC resource for connecting MySQL database.

    CREATE EXTERNAL RESOURCE `mysql_odbc_resource`
    PROPERTIES (
        "type" = "odbc_catalog",
        "host" = "192.168.0.1",
        "port" = "8086",
        "user" = "test",
        "password" = "test",
        "database" = "test",
        "table" = "test",
        "odbc_type" = "mysql",
        "driver" = "MySQL"
    );
  2. Create an ODBC resource for connecting Oracle database.

    CREATE EXTERNAL RESOURCE `oracle_odbc`
    PROPERTIES (
        "type" = "odbc_catalog",
        "host" = "192.168.0.1",
        "port" = "8086",
        "user" = "test",
        "password" = "test",
        "odbc_type" = "oracle",
        "driver" = "Oracle"
    );

Keywords

CREATE, RESOURCE
Previous
CREATE-MATERIALIZED-VIEW
Next
DROP-RESOURCE