开发者

SQL validation in IntelliJ IDEA: How to turn it off?

Does anyone know how I turn off the SQL validation in Intellij IDEA 9?

We often have more than one connection to a different type of database within one class. IntelliJ only allows one SQL dialect per c开发者_Python百科lass, resulting in what IntelliJ thinks are errors, so litters my code with red lines.

Ideally I'd just like to turn the errors off completely, as they are distracting and not actually real errors.


Settings > Inspections. Unselect 'SQL'. Alternatively you can place your cursor on the error and press alt+enter. One of the options will be 'Disable Inspection'.


You could use a comment language= before the statement, i.E.

//language=MySQL
String stmt1 = "INSERT INTO a (b) values(?)";
//language=Oracle
String stmt2 = "SELECT SYSDATE FROM dual";

See https://www.jetbrains.com/idea/help/using-language-injections.html


You can alternatively turn off the specific inspection that is bothering you. No need to turn off all SQL support (e.g. auto-complete hints are nice).

To do this, you can go to Settings --> Editor --> Inspections --> SQL and uncheck the ones you don't want. For instance, I just disabled "No data sources configured" and "Unresolved reference".

In IntelliJ Ultimate 2019.2, this looks like this:

SQL validation in IntelliJ IDEA: How to turn it off?


for IntelliJ IDEA 2017.3 you can disable sql inspections: File | Settings | Inspections | SQL

SQL validation in IntelliJ IDEA: How to turn it off?

SQL validation in IntelliJ IDEA: How to turn it off?


Usually I just put my cursor to the right of the error so the lightbulb appears. Them press alt-enter and then arrow-right. Another menu pops up that provides various supression options.

I'm not totally sure this will let you supress all the warnings globally, but you usually get rid of the ones that are troubling you fairly quickly.


No longer exists in 2018.2 Community Edition. No SQL under "Inspection" part.

Found a ticket here:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206751355-Database-navigator-plugin-generates-errors

Seems no solution yet. I am with DB navigator 3.1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜