I tried following the instructions mentioned here to add a driver for the SAP HANA database. The driver is available as a jar file, and had been added to the pom.xml:
<dependency>
<groupId>com.sap.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>1.96.0</version>
</dependency>
My application properties was as follows:
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:sap://<YOUR SAP HANA IP>:host
spring.datasource.username=sap_hana_user
spring.datasource.password=sap_hana_password
spring.datasource.driver-class-name=com.sap.db.jdbc.Driver
However, that didn't work, and I was still getting the error message:
Cannot determine embedded database driver class for database type NONE
.
What did work, was adding the Datasource programmatically, as mentioned here, and removing the application.resources
file. So, finally, my Application.java
looks like:
@SpringBootApplication
public class Application extends SpringBootServletInitializer
{
@Bean
@Primary
public DataSource dataSource()
{
return DataSourceBuilder.create().username("user_name_sap_hana").password("password_sap_hana").url("jdbc:sap://<YOUR SAP HANA IP>:port").driverClassName("com.sap.db.jdbc.Driver").build();//https://stackoverflow.com/a/28822145/1243462 ; https://stackoverflow.com/a/1336965/1243462
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(Application.class);
}
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
}
Could someone please explain what I did wrong? The first method did not mention having to do anything besides enter these details in application.resources
.