Generally we tcDataProvider to execute SQL query on OIM Database but sometime tcDataProvider doesn't help and we need java.sql.Connection. Here's how you get java.sql.Connection inside OIM:
java.sql.Connection connection = Platform.getOperationalDS().getConnection();
java.sql.Connection connection = Platform.getOperationalDS().getConnection();