spring-cloud / spring-cloud-connectors

Library to let cloud applications connect to services
Apache License 2.0
185 stars 161 forks source link

Support Oracle connections that specify an SID instead of a database name #109

Closed scottfrederick closed 9 years ago

scottfrederick commented 9 years ago

OracleServiceInfo builds a JDBC URL from the URI provided in the service credentials. The JDBC URL assumes that the path element from the credentials URI is a database name, and precedes it with a "/" in the JDBC URL (e.g. oracle://user:password@host:port/database in credentials is transformed into jdbc:oracle:thin:user/password@host:port/database)

If the path element from the credentials URI is an SID instead of a database name, then it should be preceeded by a ":" in the JDBC URL instead (e.g. oracle://user:password@host:port/sid in credentials should be transformed into jdbc:oracle:thin:user/password@host:port:sid).

See https://community.oracle.com/thread/2290690.

Supporting both database name and SID might require additional fields in the credentials so OracleServiceInfo can get an indication of what the path element of the URI represents.

scottfrederick commented 9 years ago

Alternatively, the Connector could support a jdbcUrl field in credentials, and use that if it is present. If jdbcUrl is not present, then fall back to looking for uri or url (which is what most managed database services provide) and transform the uri into a JDBC URL as it does now.

scottfrederick commented 9 years ago

Fixed in https://github.com/spring-cloud/spring-cloud-connectors/commit/b6882df6aeb4db1aa2b80eacf3dd9a7651bf57c1