Both Oracle and Sybase Kerberos Authentication using Hikari Datasource in Spring Boot

5.6k Views Asked by At

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.

0

There are 0 best solutions below