Fix connection url for Oracle and SqlServer#83
Fix connection url for Oracle and SqlServer#83xieshenzh wants to merge 2 commits intospring-cloud:mainfrom
Conversation
| map.from("password").to("spring.datasource.password"); | ||
| map.from("host", "port", "database").to("spring.datasource.url", | ||
| (host, port, database) -> String.format("jdbc:oracle://%s:%s/%s", host, port, database)); | ||
| (host, port, database) -> String.format("jdbc:oracle:thin:@%s:%s/%s", host, port, database)); |
There was a problem hiding this comment.
As I commented in #82 (comment), this is incomplete
There was a problem hiding this comment.
It is incomplete. But the old code doesn't work in any scenario. I just changed it to work in certain scenarios.
It is not possible to cover all the scenarios. Users will have to use jdbc-url in these cases.
If it is necessary to cover the three connection types (i.e. SID, Service Name, TNS), which key should the user use to specify the connection type?
If the users don't specify the connection type via service binding, the code will not be able to determine what is the connection type.
There was a problem hiding this comment.
jdbc:oracle:thin:@%s:%s/%s
Did you mean jdbc:oracle:thin:@//%s:%s/%s (service name) or jdbc:oracle:thin:@%s:%s:%s (sid) ?
I think it's good to introduce new keys connection-type (default sevice name or sid) and driver (default thin)
There was a problem hiding this comment.
I have updated the code to cover scenarios for sid, service name and tns. Please take a look. Thanks.
Update the connection url for Oracle and SqlServer that is generated by
spring-cloud-bindings.fixes: #82