spring - How to get alias.table from oracle database using HikariCP -
i came across issue recently. not sure if it's hikaricp or oracle or spring boot. when try use schema datasource.schema(application.yml/application.properties) getting error. hikaricp starts fails immediatly saying property schema doesn't exist. how supposed use schema in oracle databases?
driver class name : oracle.jdbc.pool.oracledatasource - ojdbc-7
main] com.zaxxer.hikari.hikaridatasource : hikaripool-1 - started.
main] com.zaxxer.hikari.util.propertyelf : property schema not exist on target class oracle.jdbc.pool.oracledatasource
(i know can't set schema hikaricp! how now?)
is @ possible connect oracle database using schema(alias) using hikaricp?
for wondering wth hikaricp: https://github.com/brettwooldridge/hikaricp place learn.
solution!
hikaricp takes connectioninitsql property can set to:
connectioninitsql =alter session set current_schema=xyz(your schema name)
public datasource datasource(datasourceproperties datasourceproperties){ hikaridatasource ds = new hikaridatasource(); ds.setjdbcurl(datasourceproperties.geturl()); ds.setusername(datasourceproperties.getusername()); ds.setpassword(datasourceproperties.getpassword()); ds.setconnectioninitsql("alter session set current_schema=my_schema"); return new hikaridatasource(ds); }
Comments
Post a Comment