Skip to content

Commit

Permalink
Fixing a few mistakes in SQLServerResource (#459)
Browse files Browse the repository at this point in the history
* Fixing a few mistakes in SQLServerResource

* Fix the test
  • Loading branch information
ulvii authored Aug 31, 2017
1 parent 3c9f635 commit 7e7ada5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
23 changes: 11 additions & 12 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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."},
Expand Down Expand Up @@ -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."},
Expand Down Expand Up @@ -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."},
Expand Down Expand Up @@ -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}."},
Expand Down Expand Up @@ -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."},
Expand Down Expand Up @@ -364,15 +364,15 @@ 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."},
{"R_certificateStorePlatformInvalid", "Cannot set \"keyStoreAuthentication=CertificateStore\" on a Windows operating system."},
{"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."},
Expand All @@ -386,13 +386,12 @@ 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_invalidDataTypeSupportForSQLVariant", "Unexpected TDS type ' '{0}' ' in SQL_VARIANT."},
{"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."},

};
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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 ? ;");
Expand Down

0 comments on commit 7e7ada5

Please sign in to comment.