从 PowerApps 连接到 Oracle 数据库Connect to an Oracle database from PowerApps

创建连接并在 PowerApps 中生成应用后将列出表,并在 Oracle 数据库中创建、读取、更新和删除表行。List tables, and create, read, update and delete table rows in an Oracle database after you create a connection and build an app in PowerApps. Oracle 数据库连接支持完全委派筛选、排序和其他功能,但触发器或存储过程除外。The Oracle Database connection supports full delegation of filtering, sorting, and other functions but not triggers or stored procedures.

先决条件Prerequisites

  • Oracle 9 及更高版本Oracle 9 and later
  • Oracle 客户端软件 8.1.7 及更高版本Oracle client software 8.1.7 and later
  • 安装本地数据网关Installation of an on-premises data gateway
  • 安装 Oracle 客户端 SDKInstallation of the Oracle client SDK

安装本地数据网关Install an on-premises data gateway

若要安装网关,请按照本教程中的步骤操作。To install a gateway, follow the steps in this tutorial.

本地数据网关充当网桥,提供本地数据(不位于云中的数据)与 Power BI、Microsoft Flow、逻辑应用和 PowerApps 服务之间快速安全的数据传输。An on-premises data gateway acts as a bridge, providing quick and secure data transfer between on-premises data (data that isn't in the cloud) and the Power BI, Microsoft Flow, Logic Apps, and PowerApps services. 可以将同一个网关与多个服务和多个数据源一起使用。You can use the same gateway with multiple services and multiple data sources. 有关详细信息,请参阅了解网关For more information, see Understand gateways.

安装 Oracle 客户端Install Oracle client

在作为本地数据网关的同一台计算机上,安装适用于 Windows x64 的 64 位 ODAC 12c 版本 4 (12.1.0.2.4)On the same computer as the on-premises data gateway, install the 64-bit ODAC 12c Release 4 (12.1.0.2.4) for Windows x64. 否则,如已知问题列表中所述,在尝试创建或使用连接时将会出现错误。Otherwise, an error will appear if you try to create or use the connection, as the list of known issues describes.

通过 Oracle 数据库中的表创建应用Create an app from a table in an Oracle database

  1. 在 PowerApps Studio 中,单击或点击左边缘附近的“文件”菜单上的“新建”。In PowerApps Studio, click or tap New on the File menu (near the left edge).

    “新建”选项

  2. 在“开始处理数据”下,单击或点击箭头。Under Start with your data, click or tap the arrow.

    显示已有的连接列表。A list of connections that you already have appears.

  3. 单击或点击“新建连接”。Click or tap New connection.

    新建连接

  4. 在连接列表中,单击或点击“Oracle 数据库”。In the list of connections, click or tap Oracle Database.

    新建数据库

  5. 指定 Oracle 服务器名称、用户名和密码。Specify the name of an Oracle server, a username, and a password.

    如果需要 SID,则使用以下格式指定服务器:Specify a server in this format if an SID is required:
    ServerName/SIDServerName/SID

    连接参数

  6. 单击或点击要使用的网关或安装一个网关。Click or tap the gateway that you want to use, or install one.

    如果安装网关后该网关未出现,则单击“刷新网关列表”。If your gateway doesn't appear after you install it, click Refresh gateway list.

    新建网关

  7. 单击或点击“创建”以创建连接。Click or tap Create to create the connection.

    新建

  8. 单击或点击“默认”数据集。Click or tap the default dataset.

    新建

  9. 在表列表中,单击或点击要使用的表。In the list of tables, click or tap the table that you want to use.

    新建

  10. 单击“连接”创建应用。Click Connect to create the app.

    新建

PowerApps 将创建包含三个屏幕的应用,该应用将显示所选表中的数据:PowerApps creates an app that has three screens and shows data from the table that you selected:

  • BrowseScreen1,列出表中的所有条目。BrowseScreen1, which lists all entries in the table.
  • DetailScreen1,提供单个条目的详细信息。DetailScreen1, which provides more info about a single entry.
  • EditScreen1,用户可以在此处更新条目或创建条目。EditScreen1, in which users can update an entry or create an entry.

新建

后续步骤Next steps

  • 要保存刚才生成的应用,请按 Ctrl-S。To save the app that you've just generated, press Ctrl-S.
  • 要自定义 BrowseScreen1(默认情况下会显示),请参阅自定义布局To customize BrowseScreen1 (which appears by default), see Customize a layout.
  • 若要自定义 DetailsScreen1EditScreen1,请参阅自定义窗体To customize DetailsScreen1 or EditScreen1, see Customize a form.

已知问题、建议和疑难解答Known issues, tips, and troubleshooting

  1. 无法访问网关。Cannot reach the Gateway.

    本地数据网关无法连接到云时将出现此错误。This error appears if the on-premises data gateway can't connect to the cloud. 若要检查网关状态,请登录到 powerapps.microsoft.com,单击或点击“网关”,然后单击或点击要使用的网关。To check the status of your gateway, sign in to powerapps.microsoft.com, click or tap Gateways, and then click or tap the gateway that you want to use.

    确保网关正在运行且可以连接到 Internet。Make sure that your gateway is running and can connect to the Internet. 避免在可能会关机或进入休眠状态的计算机上安装网关。Avoid installing the gateway on a computer that may be turned off or asleep. 同时尝试重启本地数据网关服务 (PBIEgwService)。Also try restarting the on-premises data gateway service (PBIEgwService).

  2. System.Data.OracleClient 需要具备 Oracle 客户端软件 8.1.7 版本或更高版本。System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

    如果未将 Oracle 客户端 SDK 安装在作为本地数据网关的同一台计算机上,则会出现此错误。This error appears if the Oracle client SDK isn't installed on the same computer as the on-premises data gateway. 若要解决此问题,请安装正式提供程序To resolve this issue, install the official provider.

  3. 表“[Tablename]”未定义任何键列。Table '[Tablename]' does not define any key columns.

    如果连接到的表不包含 Oracle 数据库连接所需的任何主键,则会出现此错误。This error appears if you're connecting to a table that doesn't have a primary key, which the Oracle Database connection requires.

  4. 在撰写本文时,存储过程、包含组合键的表以及表中的嵌套对象类型尚不受支持。As of this writing, stored procedures, tables with composite keys, and nested object types in tables aren't supported.