I am using Spring boot version 2.6 , i want to use U2 universe as database. My question is how to setting a connection in application.properties?
Asked
Active
Viewed 260 times
0
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Aug 01 '22 at 14:12
1 Answers
0
STEP 1: Install Rocket software and download unijdbc.jar(you can find the jar inside the path \U2\UniDK\jdbc\lib).
STEP 2 : Create Lib folder in your spring boot project and put the jar inside the folder.
STEP 3 : go to pom.xml file and add below dependency
<dependency>
<groupId>uni-jdbc</groupId>
<artifactId>uni-jdbc</artifactId>
<version>2.161.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/uni-jdbc.jar</systemPath>
</dependency>
STEP 4 : In application.properties file provide the datasourse details.
spring.datasource.url=jdbc:rs-u2://hostname/Account?dbmstype=UNIDATA
spring.datasource.username=username
spring.datasource.password=Password
spring.datasource.driver-class-name=com.rs.u2.jdbc.UniJDBCDriver
Make sure your URL details is correct. jdbc:rs-u2://"+host+"/"+account+"?dbmstype="+dbmstype+
STEP 5: to check the connection, run your application in debug level by adding below properties in application.properties.
logging.level.com.zaxxer.hikari=DEBUG
-
URL should be in below format spring.datasource.url=jdbc:rs-u2://hostname//Account?dbmstype=UNIDATA Dailect will be spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DB2Dialect you can see the more information regarding Dailect class in below url https://ri-doc-lts-html5.identitymgmt.net/en/jdbc-drivers.html – user20545477 Nov 24 '22 at 15:08