How PhpStorm’s Database Tool Window Lets You Query, Edit, and Commit Directly from the IDE
Discover how PhpStorm’s built‑in Database Tool Window lets you connect to MySQL, PostgreSQL, or SQLite, run live queries, edit rows, and commit changes—all inside the IDE. A quick example shows the workflow, trade‑offs, and best practices.
23 Aug 2026, 02:44 UTC

Why a Built‑In Database UI Matters
When working on a PHP project, you often need to verify that your code talks to the database correctly. Relying on external tools like phpMyAdmin or a terminal client can interrupt the flow: you have to switch windows, copy connection strings, and remember credentials. PhpStorm’s Database Tool Window eliminates that friction by letting you connect, query, and edit data inside the same environment where you write code.
Thesis: One Window, Multiple Database Tasks
The Database Tool Window (DTW) provides a unified UI for:
- Connecting to MySQL, PostgreSQL, SQLite, and any JDBC‑compatible database.
- Browsing schemas, tables, and indexes.
- Running live queries with syntax highlighting and auto‑completion.
- Editing result grids inline and committing changes.
- Managing transactions and viewing query history.
- Exporting results to CSV, JSON, or clipboard.
All of this is available in PhpStorm 2023.1 and newer, with incremental improvements in each release.
Step 1: Add a Connection
Open the DTW via View → Tool Windows → Database. Click the + icon and select the database type (e.g., SQLite). The wizard asks for:
- Driver: choose the appropriate JDBC driver (PhpStorm bundles drivers for common DBs; if missing, it will prompt you to download).
- Connection parameters: host, port, database name, username, password. For SQLite, just point to the file path.
- Test the connection. If it succeeds, the connection is cached securely and can be reused.
Example for a local SQLite file:
# In the Connection dialog
Driver: SQLite
Database: /path/to/project/data.db
# No username/password needed
Step 2: Run Live Queries and Edit Results
Once connected, you’ll see the schema tree. Double‑click a table to open the SQL Query Editor. Type a query, e.g.:
SELECT * FROM users LIMIT 10;
Press Ctrl+Enter (or click the green arrow) to execute. The Result Grid appears below the editor. It supports:
- Inline editing: double‑click a cell, change the value, and press Enter to stage the update.
- Commit button: when changes are staged, the
Commitbutton becomes active. Clicking it sends the UPDATE statements to the database. - Rollback: if you need to discard changes, click
Rollbackbefore committing.
Result history is cached; you can revisit past queries via the History tab.
Step 3: Transaction Control and Versioning
DTW respects the database’s transaction semantics. You can explicitly start a transaction in the editor with BEGIN;, execute multiple statements, and then COMMIT; or ROLLBACK;. This is handy for testing batch updates without affecting production data.
Because the query editor is part of the IDE, you can add the SQL file to your Git repo alongside PHP code. This ensures that any database changes are versioned and reproducible.
Trade‑offs and Best Practices
- Driver requirement: DTW needs a JDBC driver. If you try to connect to a database with no driver, the connection will fail. Keep drivers up‑to‑date via the IDE’s driver manager.
- Performance: Large result sets can slow down the IDE. Use
LIMITclauses or pagination queries to keep the grid responsive. - Security: Credentials are stored in the IDE’s credential helper. For shared machines, consider using environment variables or a password manager integration.
- Editing caution: Inline edits are immediate. Double‑check your changes before committing, especially in production databases.
Concrete Worked Example: Editing a User Record
- Connect to SQLite as shown above.
- Run
SELECT * FROM users WHERE id = 42;and press Ctrl+Enter. - The grid shows the user. Double‑click the
emailcell and change it to[contact removed]. - Press Enter; the cell turns orange indicating a pending change.
- Click the
Commitbutton in the toolbar. A confirmation dialog appears; confirm to send the UPDATE. - Verify the change by re‑executing the SELECT query.
Throughout this process, you never left the IDE. No external tool was needed, and the change is immediately visible in your application code if you refresh the page.
Actionable Takeaway
Enable the Database Tool Window in PhpStorm and start connecting to your dev database. Use it to:
- Quickly test queries while coding.
- Inspect schema changes and data migrations.
- Commit SQL scripts with your PHP code for reproducible deployments.
Remember to keep drivers updated, use LIMIT for large tables, and treat inline edits as first‑class changes that should be versioned. Happy querying!
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.