RubyMine does not enable you to create databases, but provides facilities to manage and query them. Once you are granted access to a certain database, you can configure one or more data sources within RubyMine that reflect the structure of the database and store the database access credentials. Based on this information, RubyMine establishes connection to the database and provides the ability to retrieve or change information contained therein.
In this section:
Data source scopes
There are the data sources that are available in all of your projects. Such data sources are said to have the IDE scope. Others, ones with the project scope, are available in only one of your projects.
Data source types
RubyMine supports data sources of the following types:
- DB data sources (also called database connections), which correspond to real databases.
- DDL data sources, which represent the necessary data structures and act as stub databases, the databases without any data. For this data source type you should have one or more SQL DDL files representing the required data structures available in your project directory (or one of its subdirectories). Also note that a particular SQL dialect should be set for all those files (or the directories containing those files).
DB data sources can have the IDE or the project scope; DDL data sources exist only at the project level.
Similarly, all database connections are automatically terminated when you exit the IDE.
The names of the data sources with open database connections are shown in the Database tool window in bold.
If necessary, you can close all unnecessary database connections manually. To do that:
- In the Database tool window, select the corresponding data source or data sources. (To select more than one data source, use mouse clicks in combination with the Ctrl key.)
Do one of the following:
- Click on the toolbar.
- Select Disconnect from the context menu.
- Press Ctrl+F2.
Overview of the features
Here is a very brief overview of RubyMine features related to working with data sources:
- 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 ability 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.
- Data sources are configured automatically on the base of the information in the
- Database console.
- Configuring DDL data sources based on data structure definition (DDL) files, integration between the data source structure and the corresponding DDL statements in the definition file.
- Generating DDL statements based on the structures of a data source.
- Configuring database management scripts as external tools and running them from within RubyMine.
- The ability to download archives and libraries with driver classes right from RubyMine.