資料來源Data Sources

SQL Server Data Tools (SSDT )SQL Server Data Tools (SSDT) 包含您可以在 MicrosoftMicrosoft Integration ServicesIntegration Services 封裝中使用的設計階段物件:資料來源。includes a design-time object that you can use in MicrosoftMicrosoft Integration ServicesIntegration Services packages: the data source.

資料來源物件是連接的參考,且至少包含連接字串和資料來源識別碼。A data source object is a reference to a connection, and at a minimum, it includes a connection string and a data source identifier. 它也可以包含描述、名稱、使用者名稱和密碼等其他中繼資料。It can also include additional metadata such a description, a name, a user name, and a password.

注意

您只能將資料來源加入到設定為使用封裝部署模型的專案。You can add data sources only to projects that are configured to use the package deployment model. 若專案設定為使用專案部署模型,您就可以使用在專案層級建立的連接管理員來共用連接,取代使用資料來源的方式。If a project is configured to use the project deployment model, you use connection managers created at the project level to share connections, in place of using data sources.

如需有關部署模型的詳細資訊,請參閱< 部署專案和封裝>。For more information about the deployment models, see Deployment of Projects and Packages. 如需將專案轉換為專案部署模型的詳細資訊,請參閱將專案部署至 Integration Services 伺服器For more information about converting a project to the project deployment model, see Deploy Projects to Integration Services Server.

Integration ServicesIntegration Services 封裝中使用資料來源的好處包括:The advantages of using data sources in Integration ServicesIntegration Services packages include the following:

  • 資料來源有專案範圍,這表示 Integration ServicesIntegration Services 專案中建立的資料來源可使用於專案中的所有封裝。A data source has project scope, which means that a data source created in an Integration ServicesIntegration Services project is available to all the packages in the project. 資料來源只要定義一次,即可由多個封裝中的連接管理員參考。A data source can be defined one time and then referenced by connection managers in multiple packages.

  • 資料來源提供資料來源物件與其封裝參考之間的同步處理。A data source offers synchronization between the data source object and its package references. 如果資料來源與參考資料來源的封裝位於同一專案,則資料來源參考的連接字串屬性便會在資料來源變更時自動更新。If the data source and the packages that reference it reside in the same project, the connection string property of the data source references is automatically updated when the data source changes.

參考資料來源Reference Data Sources

如果要將資料來源物件加入 Integration ServicesIntegration Services 專案,請以滑鼠右鍵按一下方案總管中的 [資料來源] 資料夾,然後按一下 [新增資料來源] 。To add a data source object to an Integration ServicesIntegration Services project, right-click the Data Sources folder in Solution Explorer and then click New Data Source. 項目會隨即加入至 [資料來源] 資料夾。The item is added to the Data Sources folder. 如果您要使用在其他專案中建立的資料來源物件,您必須先將物件加入專案。If you want to use data source objects that were created in other projects, you must first add them to the project.

如果您要在封裝中使用資料來源物件,可以將參考該資料來源物件的連接管理員新增至封裝中。You use a data source object in a package by adding a connection manager that references the data source object to the package. 在建立封裝控制流程及資料流程之前,或作為建構控制流程或資料流程程序中的一個步驟,將它新增至封裝中。You can add it to the package before you build the package control flow and data flows, or as a step in constructing the control flow or data flow.

資料來源物件代表至資料來源的簡單連接,並提供其參考之資料存放區中物件的存取權。A data source object represents a simple connection to a data source and provides access to the objects in the data store that it references. 例如,連接到 [SQL Server]SQL ServerAdventureWorks 範例資料庫的資料來源物件包含資料庫中的所有 60 個資料表。For example, a data source object that connects to the [SQL Server]SQL ServerAdventureWorks Sample Database includes all 60 tables from the database.

資料來源與參考資料來源的連接管理員之間沒有相依性。There is no dependency between a data source and the connection managers that reference it. 如果資料來源不再是專案的一部分,封裝將繼續有效,因為有關資料來源的資訊 (例如其連接類型和連接字串) 都包含在封裝定義中。If a data source is no longer part of the project, the packages continue to be valid, because information about the data source, such as its connection type and connection string, is included in the package definition.