diff --git a/spring-cloud-cloudfoundry-connector/src/main/java/org/springframework/cloud/cloudfoundry/SqlServerServiceInfoCreator.java b/spring-cloud-cloudfoundry-connector/src/main/java/org/springframework/cloud/cloudfoundry/SqlServerServiceInfoCreator.java index 65359261..165e6de6 100644 --- a/spring-cloud-cloudfoundry-connector/src/main/java/org/springframework/cloud/cloudfoundry/SqlServerServiceInfoCreator.java +++ b/spring-cloud-cloudfoundry-connector/src/main/java/org/springframework/cloud/cloudfoundry/SqlServerServiceInfoCreator.java @@ -2,15 +2,14 @@ import org.springframework.cloud.service.common.SqlServerServiceInfo; -public class SqlServerServiceInfoCreator extends - RelationalServiceInfoCreator { +public class SqlServerServiceInfoCreator extends RelationalServiceInfoCreator { public SqlServerServiceInfoCreator() { - super(new Tags(), SqlServerServiceInfo.SQLSERVER_SCHEME); } + super(new Tags(), SqlServerServiceInfo.SQLSERVER_SCHEME); + } @Override public SqlServerServiceInfo createServiceInfo(String id, String url) { return new SqlServerServiceInfo(id, url); } - } diff --git a/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/SqlServerServiceInfo.java b/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/SqlServerServiceInfo.java index 8b599f6c..d6fd8ee4 100644 --- a/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/SqlServerServiceInfo.java +++ b/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/SqlServerServiceInfo.java @@ -11,12 +11,15 @@ public class SqlServerServiceInfo extends RelationalServiceInfo { public SqlServerServiceInfo(String id, String url) { super(id, url, JDBC_URL_TYPE); } - - @Override - public String getJdbcUrl() - { - return String.format("jdbc:%s://%s:%d;database=%s;user=%s;password=%s;", - jdbcUrlDatabaseType, + + @Override + public String getJdbcUrl() { + if (getUriInfo().getUriString().startsWith(JDBC_PREFIX)) { + return getUriInfo().getUriString(); + } + + return String.format("jdbc:%s://%s:%d;database=%s;user=%s;password=%s", + jdbcUrlDatabaseType, getHost(), getPort(), getPath(), getUserName(), getPassword()); - } + } }