Comments (6)
A workaround is to configure the DataSource to be used manually:
@Bean
@Primary
public DataSource dataSource(
@Value("${vcap.services.<your-haas.service>.credentials.url}")final String url,
@Value("${vcap.services.<your-haas.service>.credentials.user}")final String user,
@Value("${vcap.services.<your-haas.service>.credentials.password}")final String password
) {
return DataSourceBuilder.create()
.type(HikariDataSource.class)
.driverClassName(com.sap.db.jdbc.Driver.class.getName())
.url(url)
.username(user)
.password(password)
.build();
}
from spring-cloud-sap.
Workaround including the security parameters would be:
@Bean
@Primary
public DataSource dataSource() {
HANAServiceInfo serviceInfo = (HANAServiceInfo) cloud().getServiceInfo("hana-service-instance-name");
String host = serviceInfo.getHost();
int port = serviceInfo.getPort();
String username = serviceInfo.getUserName();
String password = serviceInfo.getPassword();
String schema = serviceInfo.getUserName(); // The schemaname matches the username
String url = new UriInfo("jdbc:sap", host, port, null, null, null,
"currentschema=" + schema + "&encrypt=true&validateCertificate=true").toString();
return DataSourceBuilder.create().type(HikariDataSource.class)
.driverClassName(com.sap.db.jdbc.Driver.class.getName()).url(url).username(username).password(password)
.build();
}
from spring-cloud-sap.
it seems #7 attempts to solve this issue but it is not done in a configurable (optional) way
from spring-cloud-sap.
@Flawi thank you. your solution works for me. Have to use HikariDataSource.class. ( DataSource.class is not working). This solution will be the workaround.
Alternatively, if you would want to use Embedded tomcat container to connect to Cloud. You may follow this link https://stackoverflow.com/questions/24941829/how-to-create-jndi-context-in-spring-boot-with-embedded-tomcat-container
Any chance that @jonathanbaker7 can fix the not detected HANAServiceInfoCreator during runtime?
from spring-cloud-sap.
Getting exception mentioned in this thread SAP DBTech JDBC: [4321]: only secure connections are allowed, when trying to connect a Springboot App deployed on SAP cloud CF. Any fix for this ?
from spring-cloud-sap.
To enable Java encryption, "encrypt=true" needs to appear in JDBC URI. Are you doing this?
from spring-cloud-sap.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-sap.