Database Access Improved
March 1st, 2010 by Gregory ShragoThe latest IntelliJ IDEA 9.0.2 EAP contains a big number of Database-related functionality changes:
- Database Console now has its own toolwindow
- New console-like UI that keeps input and output in one place and retains the highlighting for execution history
- Keyboard shortcuts for all Console actions are now configurable
- Per-result Page Up, Page Down and Refresh actions
- Complete support for In-Memory Databases (try running some DDL in Console then click Refresh Tables and all the tables will be loaded in the Data Sources tree)
- Improved support for heavy JDBC drivers that use native libraries to run
- The notion of Database Connection allows IntelliJ IDEA to do some cool stuff such as Quick Table Contents Lookup integrated with Quick Documentation Lookup (Ctrl+Q)

The Hibernate Console has also been improved accordingly (separate toolwindow, console-like UI and per-result paging actions).
Try all this in the latest EAP and let us know what you think.
UPD: In the next EAP SQL scripts can be run directly from Project View or Editor via Run SQL Script (Ctrl+Shift+F10).
Tags: Database Tools, Hibernate

March 1st, 2010 at 5:28 pm
I would love to be able to hit up and get my previous query (like bash history).
It would also be nice to be able to right click on a table and select * or top 100 rows.
March 1st, 2010 at 5:37 pm
Also supporting displaying schemas as folders would be nice, e.g. instead of putting all the tables at one level, grouping tables by schema.
March 2nd, 2010 at 8:01 am
You can get the previous queries using Ctrl+Up/Ctrl+Down.
March 4th, 2010 at 7:44 am
I would rather see the last sql command remaining in the editor (like it was before) …and the history list appearing by keystroke
March 4th, 2010 at 11:16 am
The last command will remain in the editor if you use “Execute Current” (Ctrl+Shift+Enter).
March 9th, 2010 at 7:58 am
Looks good. The first couple of times I launched the Database Console, I used the icon on the Data Sources toolbar, and the resulting console refused to execute any queries. However, after I launched the console by right-clicking in the list of database tables and selecting it from the contextual menu, everything worked fine. Not sure what went wrong.
As with the previous version, I have been annoyed by having to set the SQL Dialect every time I open the Database Console; it always defaults to Plain Text, and I always change it to SQL92. Is there any way to persist this setting for a particular data source or all data sources?
March 11th, 2010 at 2:38 am
SQL Developers does not work this way.
1. make JDBC Datasource in IDE
2. make new MyScript.sql file.
3. link MyScript.sql file to JDBC Datasource (with choice box on editor in upper side)
4. write some sql scripts
5. run whole sql script or current statement (separated by blank line or
6. check result in result window
7. modify script in MyScript.sql
8. rerun script in MyScript.sql
with current console window design, I can’t save my script without copy & paste.
and inconvenient to run eveyday sql script with 200~300+ lines.
March 12th, 2010 at 4:26 pm
Fully agree with comments provided by “drypot” above.
I expect to use a regular editor window to edit SQL.
A tool window should only appear to show query results.
The SQL code completion provided by IDEA is pretty nice though
March 15th, 2010 at 1:49 pm
Starting from the next 9.0.2 EAP there’s a “Run SQL script” action available in Project View and Editor. Standard shortcut as for other run operations is Ctrl-Shift-F10 (configurable). It is designed for long scripts therefore no data output just DBMS reports.
April 26th, 2010 at 12:35 pm
Is there any way to see Hibernate SQL generated queries like in 9.0.1 HQL Console? other issue is that the HQL query recently typed doesn’t remain in the console for editing
April 28th, 2010 at 12:50 pm
Is there any way to enable “Database Console” toolwindow within Grail project?
I cannot find the path to do that.
May 4th, 2010 at 8:36 am
@Jorge_Tejada: “Generate SQL” action in Hibernate Console works the same way as in 9.0.1. Ctrl+UP/Ctrl+Down restores previously executed queries.
@Developer: Tools/Data Sources menu item if it’s the first time you create Data Source.
May 27th, 2010 at 7:51 am
I reinstalled IDEA with database plugin enabled and since then i do not have the ‘database’ tab anywhere.
in the plugin manager the database plugin is enabled..
anyone knows how to get access to it?
May 31st, 2010 at 6:44 am
If you have no Data Sources configured the tab is accessed via Tools/Data Sources. This is done to save tab bar space in case this functionality is not needed.
August 10th, 2010 at 4:11 pm
“It would also be nice to be able to right click on a table and select * or top 100 rows”
Good idea, what about the ability to easily load / save SQL queries instead of having to copy and paste between windows?
Thanks
Mark