Repository: microsoft/mssql-jdbc (java)

Issue:
Error in connection properties jaasConfigurationName SQL Server JDBC Driver JASSConfiguration
## Driver version
All versions since 6.1.7 jre8

## SQL Server version
It does not matter.

## Client Operating System
Redhat Enterprise Linux 8.5

## JAVA/JVM version
OpenJDK 1.8.0u312

## Table schema
N/A

## Problem description
From https://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?view=sql-server-ver15
The JAAS configuration name is passed via "jaasConfigurationName".
It seems to be a typo. From your JDBC driver, it shall be "JASSConfigurationName".

## Expected behavior
JAAS configuration name shall be passed in to jaasConfigurationName however it fails to pass that properties to JDBC Driver.
   JASSConfigurationName="jaas1" e.g. works.
  jassConfigurationName=jaas1 does not work.

If this is a documentation error from Microsoft. Please kindly correct them via your internal channel. Many thanks.

## Actual behavior

## Error message/stack trace

## Any other details that can be helpful

## JDBC trace logs


Pull request description:
Fixed typo in API names to align with jaasConfigurationName property
fixes #1835 

Patch:
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
index 238c4e51..530e0893 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
@@ -387,7 +387,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource {
      * @return A String that contains the server name or null if no value is set.
      */
     String getServerName();
-    
+
     /**
      * Sets the name of the preferred type of IP Address.
      * 
@@ -395,12 +395,12 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource {
      *        A String that contains the preferred type of IP Address.
      */
     void setIPAddressPreference(String iPAddressPreference);
-    
+
     /**
      * Gets the name of the preferred type of IP Address.
      * 
      * @return IPAddressPreference
-     *        A String that contains the preferred type of IP Address.
+     *         A String that contains the preferred type of IP Address.
      */
     String getIPAddressPreference();
 
@@ -788,18 +788,41 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource {
      * Sets the login configuration file for Kerberos authentication. This overrides the default configuration <i>
      * SQLJDBCDriver </i>
      * 
+     * @deprecated Use {@link ISQLServerDataSource#setJAASConfigurationName()} instead
+     * 
      * @param configurationName
      *        the configuration name
      */
+    @Deprecated
     void setJASSConfigurationName(String configurationName);
 
     /**
      * Returns the login configuration file for Kerberos authentication.
      * 
+     * @deprecated Use {@link ISQLServerDataSource#getJAASConfigurationName()} instead
+     * 
      * @return login configuration file name
      */
+    @Deprecated
     String getJASSConfigurationName();
 
+    /**
+     * Sets the login configuration file for Kerberos authentication. This overrides the default configuration <i>
+     * SQLJDBCDriver </i>
+     * 
+     * 
+     * @param configurationName
+     *        the configuration name
+     */
+    void setJAASConfigurationName(String configurationName);
+
+    /**
+     * Returns the login configuration file for Kerberos authentication.
+     * 
+     * @return login configuration file name
+     */
+    String getJAASConfigurationName();
+
     /**
      * Sets whether Fips Mode should be enabled/disabled on the connection. For FIPS enabled JVM this property should be
      * true.
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
index c30d6b15..c44dbfc3 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java
@@ -594,23 +594,26 @@ public class SQLServerDataSource
     public String getServerName() {
         return getStringProperty(connectionProps, SQLServerDriverStringProperty.SERVER_NAME.toString(), null);
     }
-    
+
     /**
      * Set the preferred type of IP Address
      * 
-     * @param iPAddressPreference Preferred IP Address type
+     * @param iPAddressPreference
+     *        Preferred IP Address type
      */
     @Override
     public void setIPAddressPreference(String iPAddressPreference) {
-        setStringProperty(connectionProps, SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.toString(), iPAddressPreference);
+        setStringProperty(connectionProps, SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.toString(),
+                iPAddressPreference);
     }
-    
+
     /**
      * Gets the preferred type of IP Address
      */
     @Override
     public String getIPAddressPreference() {
-        return getStringProperty(connectionProps, SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.toString(), SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.getDefaultValue());
+        return getStringProperty(connectionProps, SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.toString(),
+                SQLServerDriverStringProperty.IPADDRESS_PREFERENCE.getDefaultValue());
     }
 
     /**
@@ -979,17 +982,31 @@ public class SQLServerDataSource
     }
 
     @Override
+    @Deprecated
     public void setJASSConfigurationName(String configurationName) {
         setStringProperty(connectionProps, SQLServerDriverStringProperty.JAAS_CONFIG_NAME.toString(),
                 configurationName);
     }
 
     @Override
+    @Deprecated
     public String getJASSConfigurationName() {
         return getStringProperty(connectionProps, SQLServerDriverStringProperty.JAAS_CONFIG_NAME.toString(),
                 SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue());
     }
 
+    @Override
+    public void setJAASConfigurationName(String configurationName) {
+        setStringProperty(connectionProps, SQLServerDriverStringProperty.JAAS_CONFIG_NAME.toString(),
+                configurationName);
+    }
+
+    @Override
+    public String getJAASConfigurationName() {
+        return getStringProperty(connectionProps, SQLServerDriverStringProperty.JAAS_CONFIG_NAME.toString(),
+                SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue());
+    }
+
     @Override
     public void setMSIClientId(String msiClientId) {
         setStringProperty(connectionProps, SQLServerDriverStringProperty.MSI_CLIENT_ID.toString(), msiClientId);


Test patch:
diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java
index 782d1b81..224008c0 100644
--- a/src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java
+++ b/src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java
@@ -128,8 +128,8 @@ public class SQLServerConnectionTest extends AbstractTest {
         assertEquals(booleanPropValue, ds.getUseBulkCopyForBatchInsert(),
                 TestResource.getResource("R_valuesAreDifferent"));
 
-        ds.setJASSConfigurationName(stringPropValue);
-        assertEquals(stringPropValue, ds.getJASSConfigurationName(), TestResource.getResource("R_valuesAreDifferent"));
+        ds.setJAASConfigurationName(stringPropValue);
+        assertEquals(stringPropValue, ds.getJAASConfigurationName(), TestResource.getResource("R_valuesAreDifferent"));
 
         ds.setMSIClientId(stringPropValue);
         assertEquals(stringPropValue, ds.getMSIClientId(), TestResource.getResource("R_valuesAreDifferent"));