Over a million developers have joined DZone.

Idea plugin - using DataSource

DZone's Guide to

Idea plugin - using DataSource

Free Resource

Because i haven't found better solution, if there is any pls help me out. No one helped this poor guy:


So I guess there is non. 

And for the guys from JetBrains, it's easy to use connection from data source when making plugin for NetBeans IDE.

import com.intellij.javaee.dataSource.DataSource;
import com.intellij.javaee.dataSource.DataSourceManager;
import com.intellij.javaee.dataSource.ServerInstance;
import com.intellij.openapi.project.Project;
import java.lang.reflect.Method;
import java.sql.Connection;

DataSourceManager dataSourceManager = 
DataSource dataSource = 
Method getConnectionMethod  = 
dataSource.getClass().getDeclaredMethod("getConnection", Project.class, ServerInstance.class);
Connection conn =
 (Connection) getConnectionMethod.invoke(dataSource, p, null);

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}