Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make SQL editor inspect snytax in Intellij IDEA 13?

Back to 12, if I remember correctly, when editing a SQL file in SQL editor, IntelliJ IDEA will ask me what dialect am I using, and inspect its syntax.

However, with the new database tool in 13, by default the SQL editor validate nothing, I can only auto complete keywords.

The Database and SQL support plugins are enabled.

Do I need to setup anything else in order to get it works in SQL editor ? or some other options I should make sure it is enabled ?

like image 349
Rangi Lin Avatar asked Jan 01 '14 03:01

Rangi Lin


People also ask

How do I write SQL queries in IntelliJ?

Create a query consoleClick a data source and select File | New | Query Console. Right-click a data source and select New | Query Console. Click a data source, press Alt+Insert , and select Query Console. Click a data source, press Ctrl+Shift+F10 , and select New Query Console.

How do I open SQL editor in IntelliJ?

Open the Project tool window (View | Tool Windows | Project) and double-click an SQL file. Click the statement that you want to execute.

Can you use IntelliJ for SQL?

Database tools and SQLUltimateThe database management functionality in IntelliJ IDEA is supported by the Database tools and SQL plugin. The Database tools and SQL plugin provides support of all the features that are available in DataGrip, the standalone database management environment for developers.

How can I see MySQL dialect in IntelliJ?

Right-click the editing area of the input pane, select Change Dialect, and select Generic SQL.


1 Answers

First, make sure you have the necessary SQL dialect(s) configured in File > Settings > [Project Settings] > SQL Dialects.

Second, to get any code completion other than keywords (such as table and column names), IDEA needs to know about your database so it can index it. Thus you need to configure either a DataSource or DDL Source in the Database tool window. Take a look at my answer to a similar question about SQLite: How do I open a sqlite db file in my local disk in intellij 13 preview That has detailed steps (with screenshots) on how to configure a database via a DataSource. Using a DDL script is similar and should be self explanatory (just select the DDL file).

like image 191
Javaru Avatar answered Sep 30 '22 14:09

Javaru