Global and local data sources
PhpStorm distinguishes between Global and Local data sources.
- Global data sources are available in all projects in your workspace.
- Local data sources are available in one specific project only.
Types of data sources
In PhpStorm you can configure two types of data sources:
- DB data sources to access existing databases of the various types.
- DDL data sources to create data structures based on DDL files.
DB data sources can be both global and local; DDL data sources can be configured only at the project level.
PhpStorm establishes a database connection between a data source and the corresponding database automatically, the first time it needs to execute a query. A database connection is displayed in the Database tool window as a node below the data source via which it is established, and is marked with the icon.
PhpStorm closes a connection automatically upon the session termination; alternatively, you can close a database connection manually (Close Database Connection on the context menu of a connection, or EditorDeleteEditorDelete on the toolbar of the Database tool window).
Access to data sources
Access to data sources is supported through a variety of PhpStorm features and components:
- Support for SQL, which includes syntax and error highlighting, code completion, selection of words and statements, parameter lookup, and refactoring (Introduce constant, for instance).
- The possibility to use source files with injected SQL code, with different SQL dialects, configurable at the project, directory, or file level.
- Dedicated Database tool window, where you can configure data sources.
- Database console.
In this part:
- Accessing the Database Tool Window
- Creating and Importing Data Sources
- Configuring a DB Data Source
- Configuring a DDL Data Source
- Changing Properties of a Data Source
- Generating a Data Structure Definition (DDL) File
- Adding Data Structure Definition Files to a DDL Data Source
- Accessing Data Sources via the Database Console
- Viewing Table Data from the Data Sources Tool Window
- Manipulating Table Data in the Table Editor
- Running Injected SQL Statements from the Editor
- Comparing Data Sources