From 3aa8898c9a3d6824babecb4aeae19f0052e46ebc Mon Sep 17 00:00:00 2001 From: ulvii Date: Wed, 23 Aug 2017 19:32:28 -0700 Subject: [PATCH 1/2] Fixing a few mistakes in SQLServerResource --- .../sqlserver/jdbc/SQLServerResource.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java index 6539a5802..c04612594 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java @@ -38,7 +38,7 @@ protected Object[][] getContents() { {"R_invalidLength", "The length {0} is not valid."}, {"R_unknownSSType", "Invalid SQL Server data type {0}."}, {"R_unknownJDBCType", "Invalid JDBC data type {0}."}, - {"R_notSQLServer", "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2000 or later."}, + {"R_notSQLServer", "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later."}, {"R_tcpOpenFailed", "{0}. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."}, {"R_unsupportedJREVersion", "Java Runtime Environment (JRE) version {0} is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0."}, {"R_unsupportedServerVersion", "SQL Server version {0} is not supported by this driver."}, @@ -180,8 +180,8 @@ protected Object[][] getContents() { {"R_packetSizePropertyDescription", "The network packet size used to communicate with SQL Server."}, {"R_encryptPropertyDescription", "Determines if Secure Sockets Layer (SSL) encryption should be used between the client and the server."}, {"R_trustServerCertificatePropertyDescription", "Determines if the driver should validate the SQL Server Secure Sockets Layer (SSL) certificate."}, - {"R_trustStoreTypePropertyDescription", "Type of trust store type like JKS / PKCS12 or any FIPS Provider KeyStore implementation Type."}, - {"R_trustStorePropertyDescription", "The path to the certificate trust store file."}, + {"R_trustStoreTypePropertyDescription", "KeyStore type."}, + {"R_trustStorePropertyDescription", "The path to the certificate TrustStore file."}, {"R_trustStorePasswordPropertyDescription", "The password used to check the integrity of the trust store data."}, {"R_hostNameInCertificatePropertyDescription", "The host name to be used when validating the SQL Server Secure Sockets Layer (SSL) certificate."}, {"R_sendTimeAsDatetimePropertyDescription", "Determines whether to use the SQL Server datetime data type to send java.sql.Time values to the database."}, @@ -222,7 +222,7 @@ protected Object[][] getContents() { {"R_unableRetrieveSourceData", "Unable to retrieve data from the source."}, {"R_ParsingError", "Failed to parse data for the {0} type."}, {"R_BulkTypeNotSupported", "Data type {0} is not supported in bulk copy."}, - {"R_invalidTransactionOption", "UseInternalTransaction option can not be set to TRUE when used with a Connection object."}, + {"R_invalidTransactionOption", "UseInternalTransaction option cannot be set to TRUE when used with a Connection object."}, {"R_invalidNegativeArg", "The {0} argument cannot be negative."}, {"R_BulkColumnMappingsIsEmpty", "Cannot perform bulk copy operation if the only mapping is an identity column and KeepIdentity is set to false."}, {"R_CSVDataSchemaMismatch", "Source data does not match source schema."}, @@ -260,7 +260,7 @@ protected Object[][] getContents() { {"R_CertificateError", "Error occurred while retrieving certificate \"{0}\" from keystore \"{1}\"."}, {"R_ByteToShortConversion", "Error occurred while decrypting column encryption key."}, {"R_InvalidCertificateSignature", "The specified encrypted column encryption key signature does not match the signature computed with the column master key (certificate) in \"{0}\". The encrypted column encryption key may be corrupt, or the specified path may be incorrect."}, - {"R_CEKDecryptionFailed", "Exception while decryption of encrypted column encryption key : {0} "}, + {"R_CEKDecryptionFailed", "Exception while decryption of encrypted column encryption key: {0} "}, {"R_NullKeyEncryptionAlgorithm", "Key encryption algorithm cannot be null."}, {"R_NullKeyEncryptionAlgorithmInternal", "Internal error. Key encryption algorithm cannot be null."}, {"R_InvalidKeyEncryptionAlgorithm", "Invalid key encryption algorithm specified: {0}. Expected value: {1}."}, @@ -306,7 +306,7 @@ protected Object[][] getContents() { {"R_ForceEncryptionTrue_HonorAETrue_UnencryptedColumnRS", "Cannot execute update because Force Encryption was set as true for parameter {0} and the database expects this parameter to be sent as plaintext. This may be due to a configuration error."}, {"R_NullValue","{0} cannot be null."}, {"R_AKVPathNull", "Azure Key Vault key path cannot be null." }, - {"R_AKVURLInvalid", "Invalid url specified: {0}." }, + {"R_AKVURLInvalid", "Invalid URL specified: {0}." }, {"R_AKVMasterKeyPathInvalid", "Invalid Azure Key Vault key path specified: {0}."}, {"R_EmptyCEK","Empty column encryption key specified."}, {"R_EncryptedCEKNull","Encrypted column encryption key cannot be null."}, @@ -364,7 +364,7 @@ protected Object[][] getContents() { {"R_keyStoreSecretPropertyDescription", "The authentication secret or information needed to locate the secret."}, {"R_keyStoreLocationPropertyDescription", "The key store location."}, {"R_fipsProviderPropertyDescription", "FIPS Provider."}, - {"R_keyStoreAuthenticationNotSet", "\"keyStoreAuthentication\" connection string keyword must be specified, if \"{0}\" is specified."}, + {"R_keyStoreAuthenticationNotSet", "\"keyStoreAuthentication\" connection string keyword must be specified, if \"{0}\" is specified."}, {"R_keyStoreSecretOrLocationNotSet", "Both \"keyStoreSecret\" and \"keyStoreLocation\" must be set, if \"keyStoreAuthentication=JavaKeyStorePassword\" has been specified in the connection string."}, {"R_certificateStoreInvalidKeyword", "Cannot set \"keyStoreSecret\", if \"keyStoreAuthentication=CertificateStore\" has been specified in the connection string."}, {"R_certificateStoreLocationNotSet", "\"keyStoreLocation\" must be specified, if \"keyStoreAuthentication=CertificateStore\" has been specified in the connection string."}, @@ -372,7 +372,7 @@ protected Object[][] getContents() { {"R_invalidKeyStoreFile", "Cannot parse \"{0}\". Either the file format is not valid or the password is not correct."}, // for JKS/PKCS {"R_invalidCEKCacheTtl", "Invalid column encryption key cache time-to-live specified. The columnEncryptionKeyCacheTtl value cannot be negative and timeUnit can only be DAYS, HOURS, MINUTES or SECONDS."}, {"R_sendTimeAsDateTimeForAE", "Use sendTimeAsDateTime=false with Always Encrypted."}, - {"R_TVPnotWorkWithSetObjectResultSet" , "setObject() with ResultSet is not supported for Table-Valued Parameter. Please use setStructured()."}, + {"R_TVPnotWorkWithSetObjectResultSet", "setObject() with ResultSet is not supported for Table-Valued Parameter. Please use setStructured()."}, {"R_invalidQueryTimeout", "The queryTimeout {0} is not valid."}, {"R_invalidSocketTimeout", "The socketTimeout {0} is not valid."}, {"R_fipsPropertyDescription", "Determines if enable FIPS compliant SSL connection between the client and the server."}, @@ -386,10 +386,10 @@ protected Object[][] getContents() { {"R_StoredProcedureNotFound", "Could not find stored procedure ''{0}''."}, {"R_jaasConfigurationNamePropertyDescription", "Login configuration file for Kerberos authentication."}, {"R_AKVKeyNotFound", "Key not found: {0}"}, - {"R_SQLVariantSupport", "SQL_VARIANT datatype is not supported in pre-SQL 2008 version."}, + {"R_SQLVariantSupport", "SQL_VARIANT is not supported in versions of SQL Server before 2008."}, {"R_invalidProbbytes", "SQL_VARIANT: invalid probBytes for {0} type."}, - {"R_invalidStringValue", "SQL_VARIANT does not support string values more than 8000 length."}, - {"R_invalidValueForTVPWithSQLVariant", "Inserting null value with column type sql_variant in TVP is not supported."}, + {"R_invalidStringValue", "SQL_VARIANT does not support string values of length greater than 8000."}, + {"R_invalidValueForTVPWithSQLVariant", "Use of TVPs containing null sql_variant columns is not supported."}, {"R_sslProtocolPropertyDescription", "SSL protocol label from TLS, TLSv1, TLSv1.1 & TLSv1.2. The default is TLS."}, {"R_invalidSSLProtocol", "SSL Protocol {0} label is not valid. Only TLS, TLSv1, TLSv1.1 & TLSv1.2 are supported."}, }; From 9cf02f991e52e2e50322a8d59f6e8a7b983b0754 Mon Sep 17 00:00:00 2001 From: ulvii Date: Wed, 23 Aug 2017 19:45:45 -0700 Subject: [PATCH 2/2] Fix the test --- .../sqlserver/jdbc/datatypes/TVPWithSqlVariantTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/TVPWithSqlVariantTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/TVPWithSqlVariantTest.java index cd318ac67..da20156c7 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/TVPWithSqlVariantTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/datatypes/TVPWithSqlVariantTest.java @@ -290,7 +290,7 @@ public void testLongVarChar() throws SQLServerException { pstmt.execute(); } catch (SQLServerException e) { - assertTrue(e.getMessage().contains("SQL_VARIANT does not support string values more than 8000 length.")); + assertTrue(e.getMessage().contains("SQL_VARIANT does not support string values of length greater than 8000.")); } catch (Exception e) { fail("Test should have failed! mistakenly inserted string value of more than 8000 in sql-variant"); @@ -340,7 +340,7 @@ public void testNull() throws SQLServerException { tvp.addRow((Date) null); } catch (Exception e) { - assertTrue(e.getMessage().startsWith("Inserting null value with column")); + assertTrue(e.getMessage().startsWith("Use of TVPs containing null sql_variant columns is not supported.")); } pstmt = (SQLServerPreparedStatement) connection.prepareStatement("INSERT INTO " + destTable + " select * from ? ;");