Blog

IntelliJ 8: SQL Support

09 Nov, 2008
Xebia Background Header Wave

IntelliJ 8: Database Browser

A new feature is added in IntelliJ 8, which is the database browser. This functionality was already available with the help of some plugins, but now it has been integrated in the core of IntelliJ, and has been integrated in the complete IDE. This blog will give you some examples of how to set it up, and how to use it.

Setting it up

To start with, you’ll need to setup the connection to your datasource. There are two ways of doing so: the first one is by connecting to your database with a JDBC driver. The second option is by importing one or more DDL files, which will be parsed by IntelliJ. By parsing the DDL, IntelliJ makes the datasource available in the IDE.
For example, the following DDL:
will be transformed into the following structure:

This way it can be used by the user of the IDE, for example for code completion. This is best demonstrated in the following code example.

IDE Integration

By making the Datasource available in the IDE, code completion for SQL is enabled. This means that in certain code, for example when working with (Prepared)Statements, IntelliJ is aware of the Database Structure and provides seamless integration with the database by enabling code completion for tables and columns. This is demonstrated in the following code example:

Even though you are editing a String, IntelliJ knows you are actually editing an SQL statement and acts so accordingly. So IntelliJ will provide feedback, code assistance, and will make coding even more fun!

Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts