Appserver Managed Datasource Problem

I’m running IIQ on Apache Tomcat, and I’m getting the error below when I try to access a Tomcat managed datasource from a Rule running in a Task:
sailpoint.tools.GeneralException: The application script threw an exception: java.sql.SQLException: Cannot load JDBC driver class ‘com.microsoft.sqlserver.jdbc.SQLServerDriver’

The Beanshell code that causes the error is the lookup() on the third line below:

Context initialContext = new InitialContext();
  DataSource datasource = (DataSource) initialContext.lookup("java:/comp/env/jdbc/MYDS");
Connection connection = datasource.getConnection();

My Tomcat server.xml contains:

    <Resource name="jdbc/DS"
                        global="jdbc/DS"
                              auth="Container"
                              type="javax.sql.DataSource"
        driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://<IPADDR>:1433;DatabaseName=Database;user=user;password=password;encrypt=true;trustServerCertificate=true"
                              username="user" password="password"  
                              maxTotal="20"
                              initialSize="0"
                              minIdle="0"
                              maxIdle="8"
                              maxWaitMillis="10000"
                              timeBetweenEvictionRunsMillis="30000"
                              minEvictableIdleTimeMillis="60000"
                              testWhileIdle="true"
                              poolPreparedStatements="true"
                              maxOpenPreparedStatements="100"
                              validationQuery="SELECT 1"
                              maxAge="600000"
                              rollbackOnReturn="true"
                              />

and my Tomcat context.xml contains:

<ResourceLink name="jdbc/MYDS"
                            global="jdbc/DS"
                            auth="Container"
                            type="javax.sql.DataSource" />

Any help would be appreciated.

Did you add an MSSQL JDBC driver in the tomcat lib directory?
As it is Tomcat making the connection and not IdentityIQ.

– Remold

1 Like

Yes, the MSSQL driver is in the Tomcat lib directory.

Thanks.

Well, the file was in the application, but not in the Tomcat lib directory! Thanks for the clue, Mr. Krol!

It might sound like a strange idea, but can you remove the file mysql-connector-java-8.0.28.jar from directory:
identityiq/WEB-INF/lib-connectors/dbRequired3rdParty

– Remold

So it does work now ?

– Remold

1 Like

Yes! Thank you, Herr Krol!

1 Like

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