-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix connection url for Oracle and SqlServer #83
base: main
Are you sure you want to change the base?
Fix connection url for Oracle and SqlServer #83
Conversation
@@ -49,7 +49,7 @@ public void process(Environment environment, Bindings bindings, Map<String, Obje | |||
map.from("username").to("spring.datasource.username"); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I commented in #82 (comment), this is incomplete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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