您可以创建、更新、删除和共享与数据源的连接。具有“DV 内容作者”访问权限的 Oracle Analytics 用户可以执行这些操作。
主题:
您可以更新数据源的连接详细信息。
如果您要编辑与 Oracle 数据库的 SSL 连接并且需要使用新的 cwallet.sso
文件,请在客户端 Wallet字段中单击选择,浏览到 cwallet.sso
文件。向管理员询问 cwallet.sso
文件的位置。
您可以从 Oracle Analytics Cloud 中删除数据源连接。例如,在数据库的密码发生更改后,您必须删除数据库连接并创建新连接。
如果连接包含任何数据集,则必须先删除数据集,然后才能删除连接。
使用“创建连接”对话框或“检查”对话框指定连接详细信息时,有些数据库类型具有额外的配置选项。
一般选项
sales.example.com =(DESCRIPTION= (ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON) (ADDRESS=(PROTOCOL=tcp)(HOST=123.45.67.111)(PORT=1521)) (ADDRESS=(PROTOCOL=tcp)(HOST=123.45.67.222)(PORT=1521)) (ADDRESS=(PROTOCOL=tcp)(HOST=123.45.67.333)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))
启用批量复制 — 如果您要为工作簿加载数据集,则应禁用此选项,并且可以忽略它。此选项保留供数据分析师和高级用户从一个数据库向另一个数据库复制数据。
验证选项
系统连接
单击复制以复制连接的对象 ID。企业建模人员可以将此 ID 粘贴到模型管理工具(“连接池”对话框)中的对象 ID,以标识和使用数据连接。
注:如果您在最初创建连接时未单击系统连接,那么,当您在以后希望数据建模人员使用连接详细信息时,您必须创建新连接并选择系统连接。换而言之,无法在以后编辑连接并选择此选项。
请在了解数据库连接需求后创建数据库连接。
Oracle Analytics 中最多显示 10,000 个数据库表。如果您需要使用其他表,Oracle 建议您请求数据库管理员创建一个有权访问您要分析的特定对象的数据库用户,并在创建数据库连接时指定该用户的身份证明。
如果连接到 Oracle 数据库、Oracle Autonomous Data Warehouse、Oracle Transaction Processing、Snowflake、SQL Server 或 My SQL,则可以更改默认的引用标识符,以便可以读取表名或列名中具有大写、小写或混合大小写字符的数据。
select "EfG_Field" from "AbCd";
中添加双引号,而不是发出 select EfG_Field from AbCd;
(这会失败)。您可以使用 Oracle Analytics Cloud REST API 以编程方式管理与各种数据源的连接。例如,您可能想创建一个脚本在测试和生产 Oracle Analytics Cloud 环境中创建(或修改)同一组连接。
您可以使用 REST API 为各种数据源创建、更新和删除连接。本主题列出可以使用 REST API 管理的数据源连接类型。
支持的数据源
连接参数
每个数据源所需的连接参数有所不同。如果您要使用 REST API 创建或更新连接,您必须知道数据源所需的 JSON 有效负载格式。请参见数据源的 JSON 有效负载示例。
下面介绍了开始使用 Oracle Analytics Cloud REST API 以编程方式管理连接的常见任务。首次使用 REST API 时,请将以下任务作为操作指南。
任务 | 说明 | REST API 文档 |
---|---|---|
了解先决条件 |
了解并完成多个先决条件任务。 您必须有权在 Oracle Analytics Cloud 中创建工作簿并连接到数据,才能使用 REST API 管理数据连接(DV 内容作者)。 |
Prerequisites |
了解 OAuth 2.0 令牌验证 | Oracle Analytics Cloud 中的验证和授权由 Oracle Identity Cloud Service 管理。要访问 Oracle Analytics Cloud REST API,您需要 OAuth 2.0 访问令牌以便授权。 | OAuth 2.0 Token Authentication |
了解支持的数据源 | 阅读相关主题,了解可以使用 REST API 管理的数据连接类型。 | 支持的数据源 |
确定 JSON 有效负载格式 | 阅读相关主题,了解数据源的 JSON 有效负载格式,并获取所需的连接参数。 | 数据源的 JSON 有效负载示例 |
Create a connection | 创建要在工作簿、报表和仪表盘中使用的数据连接。 | Create a connection (Preview) |
Update a connection | 更新现有数据连接的一个或多个属性。 | Update a connection (Preview) |
Delete a connection | 删除数据连接。 | Delete a connection (Preview) |
以下示例可用于帮助您使用 cURL 通过 REST API 请求管理数据源连接。
cURL 格式示例
curl --header "Authorization: Bearer <token>" --header "Content-Type: application/json" --request POST|PUT https://<hostname>/api/20210901/catalog/connections --data "<data source connection payload>"
curl --header "Authorization: Bearer <token>" --request POST|PUT https://<hostname>/api/20210901/catalog/connections --form "cert=<security wallet file>" --form "connectionParams=<data source connection payload>"
<token> — 验证对 Oracle Analytics Cloud REST API 的调用所需的 OAuth 2.0 Bearer 令牌。请参见 OAuth 2.0 Token Authentication。
<hostname> — 运行 Oracle Analytics Cloud 的主机。
<data source connection payload> — 特定于数据源的连接信息。请参见数据源的 JSON 有效负载示例。
<security wallet file> — 存储 SSL 相关信息,例如验证和签名身份证明、私有密钥、证书和可信证书。一些连接类型需要这些信息,例如使用 SSL 的 Oracle 数据库和 Oracle Autonomous Data Warehouse(相互 TLS)。
示例
以下示例介绍了如何创建与 Oracle Autonomous Data Warehouse (ADW) 的连接。
cwallet.sso
(相互 TLS)注:
这些示例中的 JSON 有效负载特定于 Oracle ADW。其他数据源的 JSON 有效负载格式有所不同。请参见支持的数据源的 JSON 有效负载示例。示例 1 — 创建与 Oracle ADW 的无 Wallet (TLS) 连接
oracle_adw_walletless
的连接。请求正文包含简单 JSON application/json
。
curl --header "Authorization: Bearer <token>" --header "Content-Type: application/json" --request POST https://example.com/api/20210901/catalog/connections --data "{ "version": "2.0.0", "type": "connection", "name": "oracle_adw_walletless", "description": "Sample Oracle ADW connection without a wallet created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-autonomous-data-warehouse", "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.us-ashburn-1.oraclecloud.com))(connect_data=(service_name=abcdefg1hijkl2m_adwwalletless_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))", "username": "ADMIN", "password": "<<password>>", "systemConnection": false, "remoteData": false, "sslType": "ServerSideSSL" } } }"
响应正文
{"connectionID":"J0FkbWluJy4nb3JhY2xlX2Fkd193YWxsZXRsZXNzJw=="}
记下响应正文中的 Base64 编码 connectionId
。以后,可以使用此值更新或删除连接。
示例 2 — 创建与 Oracle ADW 的连接,此连接使用 Wallet 文件(相互 TLS)
oracle_adw_with_wallet
的连接。请求正文包含 multipart/form-data
,即,需要来自 Oracle ADW 的 Wallet 文件 (cwallet.sso
) 和 Oracle ADW 连接参数。
curl --header "Authorization: Bearer <token>" -–request POST https://<hostname>/api/20210901/catalog/connections --form "cert=@"/Users/scott/Downloads/Wallet_adw/cwallet.sso"" --form "connectionParams= "{ "version": "2.0.0", "type": "connection", "name": "oracle_adw_with_wallet", "description": "Sample Oracle ADW connection with a wallet created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-autonomous-data-warehouse", "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps) (port=1522)(host=adb.us-ashburn-1.oraclecloud.com))(connect_data=(service_name=abcdefg1hijkl2m_walletadw_high.adwc.oraclecloud.com/))(security=(ssl_server_dn_match=yes)))", "username": "ADMIN", "password": "<<password>>", "remoteData": "false", "systemConnection": false, "sslType": "ClientSideSSL" } } }"
响应正文
{"connectionID":"J2FkbWluJy4nb3JhY2xlX2Fkd193aXRoX3dhbGxldCc="}
记下响应正文中的 Base64 编码 connectionId
。以后,可以使用此值更新或删除连接。
《REST API for Oracle Analytics Cloud》中提供了其他示例。请参见 Create a connection、Update a connection 和 Delete a connection。
要连接到数据源,您需要提供连接参数。使用连接 REST API 时,您需要以 JSON 有效负载格式指定连接参数。使用下表确定要连接到的数据源的 JSON 有效负载。
数据源 | 请求类型 | 输入有效负载 |
---|---|---|
Oracle 数据库 (非 SSL) |
应用程序/json |
基本连接类型 { "version": "2.0.0", "type": "connection", "name": "oracle_db_non_ssl_basic", "description": "Sample non-SSL Oracle Database connection created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-database", "host": "example.com", "port": "1521", "serviceName": "orcl", "username": "admin", "password": "<password>", "remoteData": false, "systemConnection": false } } } 高级连接类型 { "version": "2.0.0", "type": "connection", "name": "oracle_db_non_ssl_advanced ", "description": " Sample non-SSL Oracle Database connection created with the advanced connection string format using Connections API", "content": { "connectionParams": { "connectionString": "(DESCRIPTION= (ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON) (ADDRESS=(PROTOCOL=tcp)(HOST=example.com)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=ORCLPDB1)))", "username": "admin", "password": "<password>", "connectionType": "oracle-database", "remoteData": false, "systemConnection": false } } } |
使用 SSL 的 Oracle 数据库 |
多部分/表单数据 |
cwallet.sso (client credentials file) 基本连接类型 cert: <cwallet.sso file location> connectionParams: { "version": "2.0.0", "type": "connection", "name": "oracle_db_ssl", "description": "Sample Oracle Database connection with SSL created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-database", "host": "example.com", "port": "2484", "serviceName": "ORCLPDB1", "username": "admin", "password": "<password>", "systemConnection": false, "remoteData": false } } } |
Oracle Autonomous Data Warehouse — 无 Wallet (TLS) |
应用程序/json |
基本连接类型 { "version": "2.0.0", "type": "connection", "name": "oracle_adw_walletless_basic", "description": "Sample Oracle ADW connection without a wallet created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-autonomous-data-warehouse", "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521) (host=example.com)) (connect_data=(service_name=example.com)) (security=(ssl_server_dn_match=yes)))", "username": "admin", "password": "<password>", "systemConnection": false, "remoteData": false, "sslType": "ServerSideSSL" } } } |
Oracle Autonomous Data Warehouse — Wallet(相互 TLS) |
多部分/表单数据 |
cwallet.sso (client credentials file) 基本连接类型 cert: <cwallet.sso file location> connectionParams: { "version": "2.0.0", "type": "connection", "name": "oracle_adw_with_wallet", "description": "Sample Oracle ADW connection with wallet created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-autonomous-data-warehouse", "connectionString": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps) (port=1522)(host=example.com)) (connect_data=(service_name=example.com)) (security=(ssl_server_dn_match=yes)))", "username": "admin", "password": "<password>", "remoteData": "false", "systemConnection": false, "sslType": "ClientSideSSL" } } } |
PostgreSQL (非 SSL) |
应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "postgres_non_SSL", "description": "Sample PostgreSQL connection created using Connections API", "content": { "connectionParams": { "connectionType": "postgresql-database", "host": "example.com", "port": "5432", "serviceName": "postgres", "username": "admin", "password": "<password>", "remoteData": false, "systemConnection": false } } } |
使用 SSL 的 PostgreSQL |
应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "postgres_SSL_Conn", "description": "Sample PostgreSQL connection with SSL created using Connections API", "content": { "connectionParams": { "connectionType": "postgresql-database", "host": "example.com", "port": "5432", "serviceName": "postgres", "username": "admin", "password": "<password>", "sslType":"ServerSideSSL", "remoteData": false, "systemConnection": false } } } |
SQL Server (非 SSL) |
应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "SqlServer_non_ssl", "description": "Sample non-SSL SQL Server connection created using Connections API", "content": { "connectionParams": { "connectionType": "sqlserver-database", "host": "example.com", "port": "1400", "serviceName": "sqlserver1", "username": "admin", "password": "<password>", "remoteData": false, "systemConnection": false } } } |
使用 SSL 的 SQL Server | 应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "SqlServer_ssl", "description": "Sample SQL Server connection with SSL created using the Connections API", "content": { "connectionParams": { "connectionType": "sqlserver-database", "host": "example.com", "port": "60190", "serviceName": "sqlserver1", "username": "admin", "password": "<password>", "sslType":"ServerSideSSL", "remoteData": false, "systemConnection": false } } } |
MySQL (非 SSL) |
应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "MySql_no_SSL", "description": "Sample MySQL connection created using the Connections API", "content": { "connectionParams": { "connectionType": "mysql-database", "host": "example.com", "port": "3307", "serviceName": "mysql1", "username": "admin", "password": "<password>", "remoteData": false, "systemConnection": false } } } |
使用 SSL 的 MySQL | 应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "MySql_ssl", "description": "Sample MySQL connection with SSL created using Connections API", "content": { "connectionParams": { "connectionType": "mysql-database", "host": "example.com", "port": "3306", "serviceName": "mysql1", "username": "admin", "password": "<password>", "sslType":"ServerSideSSL", "remoteData": false, "systemConnection": false } } } |
Oracle Essbase |
应用程序/json |
基本连接类型 { "version":"2.0.0", "type": "connection", "name": "Oracle_Essbase", "description": "Sample Oracle Essbase connection created using Connections API", "content": { "connectionParams": { "connectionType": "oracle-essbase", "dsn":"example.com", "username":"admin", "password":"<password>", "remoteData": false, "systemConnection": false, "authentication":"current"/"private"/"sso" } } } |