DB conection bar for custom language


Hi, I am developing a plugin for custom language. The plugin should take some data from the DB and annotate errors or warnings. You could do that for .sql files by selecting db source in the db connection bar. Is there a way to add such a bar for custom language and get data from the db?

Official comment

Hi Kislyak1000,

Unfortunately, you can't add such toolbar and attach a file with a custom language to the data source sessions.

However, you can get a list of all data sources in your project:


And you can get / create a default session for each data source:

com.intellij.database.console.session.DatabaseSessionManager#getSession(com.intellij.openapi.project.Project, com.intellij.database.dataSource.DatabaseConnectionPoint)

And write your own picker, where the user will choose the Data Source, which you can use for your annotation.


Could you please clarify if I understand the case correctly?

You have a custom language for manipulating data in a database. Is it correct? What kind of database is it? SQL database? Any SQL database? Something else?

I understand that you want to connect to a database, fetch some information, e.g., about the existence of tables/columns, and annotate errors if something doesn't exist. Is the connection a must, or do you just need this information in any way, and this is just what came to your mind at first?

Please provide us with more details like this. Thanks.


Basically, my custom language is just a file with a list of files located in other folders.

These files (e.g., groovy/g_script.groovy) can be deployed to various db instances. The idea is that the plugin will take checksum data from the remote db and compare it with a checksum of files in the project to check whether or not they were deployed.

We are only using Postgres and Oracle db. The connection is a must since I need to compare checksums. The connection bar came to my mind because it is the simplest way to change db connections and check if files were deployed.



Anna Rodionova should I add any new dependency?


Please sign in to leave a comment.