英文:
Both Oracle and Sybase Kerberos Authentication using Hikari Datasource in Spring Boot
问题
在我的Spring Boot应用程序中,我正在使用两个数据库,Oracle和Sybase,并使用Kerberos连接数据库。当我分别对它们中的一个应用Kerberos时,运行良好;但当我同时使用它们时,出现异常。
我在.yml
文件中为两个数据库配置数据源如下:
database:
oracleDatasource:
DriverclassNqme: *oracle Driver*
JdbcUrl: JdbcUrl
data-source-properties:
oracle.net.kerberos5_cc_name: *cache文件的位置*
oracle.net.authentication_services: (KERBEROS5)
oracle.net.kerberos5_mutual_authentication: true
sybaseDataSource:
driverClassName: com.sybase.jdbc4.jdbc.SybDriver
jdbcUrl: SyabaseDataBaseUrl
data-source-properties:
REQUEST_KERBEROS_SESSION: true
SERVICE_PRINCIPLE_NAME: principlename
对于Sybase,我有一个jass.conf
文件:
com.sun.security.jggs.initiate {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=true
ticketCache="我的sybase缓存文件路径";
};
当我使用以下VM参数运行应用程序时:
-Djava.security.krb5.conf="我的conf文件路径"
-Djava.security.auth.login.config="我的jass.conf文件路径"
-Djavax.security.auth.useSubjectCredsOnly=false
在这个时候,对于Oracle数据源,我遇到了以下异常:
Caused by: com.zaxerr.hikari.pool.HikariPool$InitializationException: Failed to initialize the pool: EncryptionKey: Key byte can not be null
当我从参数中删除-Djavax.security.auth.useSubjectCredsOnly=false
时,对于Sybase数据源,我遇到了以下异常:
ERROR IdTableHelper unable to obtain jdbc Connection
java.sql.SQLException: JZ006: caught IOException: java.net.ConnectException: Connection timed out
有人可以帮助我解决这个问题,或者指导我如何在Sybase的数据源属性中像Oracle那样使用Kerberos缓存文件吗?非常感谢您的帮助和建议。提前致谢。
英文:
In my spring boot application I am using two databases Oracle and Sybase and connecting the database using Kerberos. When I kerberised one of them at a time it worked good, but when I try to use both of them at the same time I'm getting an exception.
My datasource for both the database in .yml
file are as:
database:
oracleDatasource:
DriverclassNqme:*oracle Driver*
JdbcUrl: JdbcUrl
data-source-properties:
oracle.net.kerberos5_cc_name:*location of cache File*
oracle.net.authentication_services: (KERBEROS5)
oracle.net.kerberos5_mutual_authentication: true
sybaseDataSource:
driverClassName: com.sybase.jdbc4.jdbc.SybDriver
jdbcUrl: SyabaseDataBaseUrl
data-source-properties:
REQUEST_KERBEROS_SESSION: true
SERVICE_PRINCIPLE_NAME: principlename
and I am having one jass.conf
file for the Sybase
com.sun.security.jggs.initiate{
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=true
ticketCache="path of my sybasecache File"
};
When I run the my application with below VM argument ,
-Djava.security.krb5.conf="path of my conf file"
-Djava.security.auth.login.config="path of my jass.conf file"
-Djavax.security.auth.useSubjectCredsOnly=false
at the time I getting the below exception for Oracle datasource
Caused by:com.zaxerr.hikari.pool.HikariPool$InitializationException:Failed to initialize the pool:EncryptionKey:Key byte can not be null
and when I removed the -Djavax.security.auth.useSubjectCredsOnly=false
from argument at that time getting the below exception for SybaseDataSource,
ERROR IdTableHelper unable to obtain jdbc Connection
java.sql.SQLException:JZ006:caught IOException:java.net.ConnectException:Connection timed out"
Can any one help me out how to fix this or how can I use the Kerberos cache file in datasource properties for the Sybase same like Oracle.
Any help suggestion must be appreciated. Thanks in Advance.
专注分享java语言的经验与见解,让所有开发者获益!
评论