Accessing IdentityIQ database from Plugin

Hello once again fellas!
Just wanted to know, how do you guys managed to workaround (if it’s possible) to access Identityiq Tables froma plugin?
Because as far as i’m understanding the method that i’m trying to use to open a connection such as getJdbcConnection or getConnection(depracted) are simply connecting to the Plugin Dabatase Table and I can’t understand if there’s a way to open a connection to the normal identityiq Table

1 Like

There are two easy ways, which are equivalent:

  • Environment.getEnvironment().getPluginsConfiguration().getDataSource().getConnection()
  • PluginBaseHelper.getConnection()

The “Environment” class is essentially the container that Spring injects all the services into on startup, including the plugin datasource.

1 Like

Thank you Devin! I’ll try!

I just realized I read your question backwards, though. The answers I posted are for getting the plugin DB connection.

I’d actually recommend using Environment to get the non-plugin DB connection as well.

Environment.getEnvironment.getSpringDataSource().getConnection()

If you use the usual context.getJdbcConnection() (which you could), you end up with an object that is essentially 5 layers of JDBC wrappers. The second to last one has a bug where when you do connection.close(), it nulls out the underlying wrapped connection.

However, the SailPointContext actually caches the Connection object for re-use, so you end up with a broken Connection if you do getConnection() a second time on the same context. Accessing the Environment’s DataSource directly (as IIQ’s Hibernate code already does) avoids this problem.

Hi Devin,
Thank you for the reply I’ve trying to use this second method that you suggested me and I’m struggling to work with the Environment interface, I’ve tried to read javadoc about it and search in the net for a while but can’t find any help.
Do you have some documentation or perhaps some time to describe me the functionality of this method that you are using?
Environment.getEnvironment.??

Thank you again!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.