9.2.2. 安装 Microsoft SQL Server 驱动程序
要为红帽构建的 Keycloak 安装 Microsoft SQL Server 驱动程序:
从以下源之一下载
mssql-jdbcJAR 文件:- 从 用于 SQL Server 页的 Microsoft JDBC 驱动程序 下载版本。
-
通过
mssql-jdbcMaven Central。 - 数据库厂商推荐的安装介质适用于使用的特定数据库。
-
在运行 unzipped 分发时:防止 Red Hat build of Keycloak 的
providerfolder 中的mssql-jdbc 在运行容器时:构建自定义红帽构建的 Keycloak 镜像,并在
provider文件夹中添加 JAR。当为红帽构建的 Keycloak Operator 构建自定义镜像时,这些镜像需要使用红帽构建的 Keycloak 集合的所有构建时选项优化镜像。构建可用于红帽构建的 Keycloak Operator 的镜像的最小 Containerfile,包括从 Maven Central 下载的 Microsoft SQL Server JDBC 驱动程序,如下所示:
FROM registry.redhat.io/rhbk/keycloak-rhel9:26.2 ADD --chown=keycloak:keycloak --chmod=644 https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc/12.8.2.jre11/mssql-jdbc-12.8.2.jre11.jar /opt/keycloak/providers/mssql-jdbc.jar # Setting the build parameter for the database: ENV KC_DB=mssql # Add all other build parameters needed, for example enable health and metrics: ENV KC_HEALTH_ENABLED=true ENV KC_METRICS_ENABLED=true # To be able to use the image with the Red Hat build of Keycloak Operator, it needs to be optimized, which requires Red Hat build of Keycloak's build step: RUN /opt/keycloak/bin/kc.sh build如需有关如何 构建优化镜像的详细信息,请参阅在容器中运行 Keycloak 的 Keycloak 部分。
然后,继续配置数据库,如下一节中所述。