Get connected databases info


Whether there is a way to get all available databases (datasources) for current project and get some meta-information about them like displayed in database plugin (table names, column names, etc.) ?


1 comment
Comment actions Permalink

The entry point is a project component



The database model API (tables, columns, etc.) is in the package



 So you do something like this:

// iterate through all data sources (project and global)
for (DbDataSource dataSource : DbPsiFacade.getInstance(project).getDataSources()) {

// dataSource.getModel().traverser() will list all the objects

// com.intellij.database.util.DasUtil is a convenience class for the same task:
// e.g. iterate through all tables
for (DasTable table : DasUtil.getTables(datasource)) {


Please sign in to leave a comment.