Keycloak v8.0.0 with Oracle 18c with driver ojdbc8

I tried to connect keycloak 8.0.0 with oracle 18c database on Ubuntu

module.xml :
<?xml version="1.0" encoding="UTF-8"?>

<module name="com.Oracle" xmlns="urn:jboss:module:1.3">
      <resources>
        <resource-root path="ojdbc8.jar"/>
        <resource-root path="ojdbc8.policy"/>
    </resources>
  <dependencies>
        <module name="javax.api"/>
		<module name="javax.transaction.api"/>
     </dependencies>
</module>

and standalone.xml file :

<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
        <connection-url>jdbc:oracle:thin:@192.168.1.52:1521:xe</connection-url>
        <driver>oracle</driver>
        <pool>
            <min-pool-size>5</min-pool-size>
            <max-pool-size>15</max-pool-size>
            <fair>false</fair>
            <flush-strategy>IdleConnections</flush-strategy>
        </pool>
        <security>
            <user-name>keycloak</user-name>
             <password>keycloak</password>
         </security>
         <validation>
             <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
              <validate-on-match>true</validate-on-match>
              <background-validation>true</background-validation>
              <background-validation-millis>6000</background-validation-millis>
              <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
                            <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
         </validation>
         <timeout>
             <blocking-timeout-millis>5000</blocking-timeout-millis>
              <idle-timeout-minutes>5</idle-timeout-minutes>
          </timeout>
 </datasource> 

can anybody help please ?

also:
https://stackoverflow.com/questions/59772103/keycloak-with-oracle-18c-database-is-not-working

Thanks in advance.

Afraid Oracle 18 is not supported right now. We’re hoping this will be resolved in Keycloak 9, but it is a bit out of our control as we’re dependent on support in underlying WildFly container.

@stianst
Thank you so much for replying,
what is the latest version of oracle that Keycloak supports?

12, which I’m afraid is already EOL by Oracle.

i am recently also trying to update to oracle DB 18c/19c (but for redhat sso 7.3/keycloak 4.8.3), i managed to make it works by:

edit the standalone.bat

<datasources>
	<datasource jta="true" jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" statistics-enabled="false">
		<connection-url>{jdbc_connection_string}</connection-url>
		<driver>oracle</driver>
		<security>
			<user-name>{DB_username}</user-name>
			<password>{DB_password}</password>
		</security>
	</datasource>
	<drivers>
		<driver name="oracle" module="com.oracle.ojdbc8"> <!-- add module definition in advanced -->
			<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
		</driver>
	</drivers>
</datasources>

<spi name="connectionsJpa">
	<provider name="default" enabled="true">
		<properties>
			<property name="dataSource" value="java:jboss/datasources/KeycloakDS"/>
			<property name="initializeEmpty" value="true"/>
			<property name="migrationStrategy" value="update"/> 
			<property name="driverDialect" value="org.hibernate.dialect.Oracle12cDialect"/>  <!-- take note -->
			<property name="migrationExport" value="${jboss.home.dir}/keycloak-database-update.sql"/>
		</properties>
	</provider>
</spi>

<!-- change from ExampleDS to KeycloakDS -->

<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/KeycloakDS" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>

1 Like