Giter Club home page Giter Club logo

Comments (6)

rkschamer avatar rkschamer commented on September 15, 2024 1

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.

markdevries avatar markdevries commented on September 15, 2024 1

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.

eranberg avatar eranberg commented on September 15, 2024

it seems #7 attempts to solve this issue but it is not done in a configurable (optional) way

from spring-cloud-sap.

junnyea avatar junnyea commented on September 15, 2024

@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.

naheedmk avatar naheedmk commented on September 15, 2024

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.

jeffalbion avatar jeffalbion commented on September 15, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.