undo some changes made to SQLServerConnection
@@ -117,15 +117,16 @@ public class SQLServerConnection implements ISQLServerConnection {
private SqlFedAuthToken fedAuthToken = null;
+ private String originalHostNameInCertificate = null;
+
private Boolean isAzureDW = null;
static class Sha1HashKey {
private byte[] bytes;
Sha1HashKey(String sql,
- String parametersDefinition,
- String dbName) {
- this(String.format("%s%s%s", sql, parametersDefinition, dbName));
+ String parametersDefinition) {
+ this(String.format("%s%s", sql, parametersDefinition));
}
Sha1HashKey(String s) {
@@ -1210,6 +1211,23 @@ public class SQLServerConnection implements ISQLServerConnection {
pooledConnectionParent = pooledConnection;
+ String hostNameInCertificate = activeConnectionProperties.
+ getProperty(SQLServerDriverStringProperty.HOSTNAME_IN_CERTIFICATE.toString());
+
+ // hostNameInCertificate property can change when redirection is involved, so maintain this value
+ // for every instance of SQLServerConnection.
+ if (null == originalHostNameInCertificate && null != hostNameInCertificate && !hostNameInCertificate.isEmpty()) {
+ originalHostNameInCertificate = activeConnectionProperties.
+ getProperty(SQLServerDriverStringProperty.HOSTNAME_IN_CERTIFICATE.toString());
+ }
+
+ if (null != originalHostNameInCertificate && !originalHostNameInCertificate.isEmpty()) {
+ // if hostNameInCertificate has a legitimate value (and not empty or null),
+ // reset hostNameInCertificate to the original value every time we connect (or re-connect).
+ activeConnectionProperties.setProperty(SQLServerDriverStringProperty.HOSTNAME_IN_CERTIFICATE.toString(),
+ originalHostNameInCertificate);
+ }
+
String sPropKey;
String sPropValue;
@@ -5739,18 +5757,18 @@ public class SQLServerConnection implements ISQLServerConnection {
}
/**
- * Returns true if statement pooling is disabled.
+ * Determine whether statement pooling is disabled.
*
- * @return
+ * @return true if statement pooling is disabled, false if it is enabled.
*/
public boolean getDisableStatementPooling() {
return this.disableStatementPooling;
}
/**
- * Sets statement pooling to true or false;
+ * Disable/enable statement pooling.
*
- * @param value
+ * @param value true to disable statement pooling, false to enable it.
*/
public void setDisableStatementPooling(boolean value) {
this.disableStatementPooling = value;
