Add error code for SAP Hana
This commit adds a SQLErrorCodes instance for SAP DB, based on a contribution from Andrew Clemons Mostly based on SAP Hana SPS 07 with a few additional codes that are only present is previous versions: * -813 - Cannot connect to host somehost:30115 [Connection refused] * -709 - Unknown host somehost:30115 [somehost], -709.] * -708 - Cannot connect to jdbc:sap://somehost:30115 [Receive of connect failed.] * -11210 - Invalid column index XYZ. Issue: SPR-11770
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,6 +36,7 @@ import static org.mockito.BDDMockito.*;
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Thomas Risberg
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class SQLErrorCodesFactoryTests {
|
||||
|
||||
@@ -120,6 +121,22 @@ public class SQLErrorCodesFactoryTests {
|
||||
assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "-204") >= 0);
|
||||
}
|
||||
|
||||
private void assertIsHana(SQLErrorCodes sec) {
|
||||
assertTrue(sec.getBadSqlGrammarCodes().length > 0);
|
||||
assertTrue(sec.getDataIntegrityViolationCodes().length > 0);
|
||||
|
||||
assertTrue(Arrays.binarySearch(sec.getBadSqlGrammarCodes(), "368") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getPermissionDeniedCodes(), "10") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getDuplicateKeyCodes(), "301") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getDataIntegrityViolationCodes(), "461") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getDataAccessResourceFailureCodes(), "-813") >=0);
|
||||
assertTrue(Arrays.binarySearch(sec.getInvalidResultSetAccessCodes(), "582") >=0);
|
||||
assertTrue(Arrays.binarySearch(sec.getCannotAcquireLockCodes(), "131") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getCannotSerializeTransactionCodes(), "138") >= 0);
|
||||
assertTrue(Arrays.binarySearch(sec.getDeadlockLoserCodes(), "133") >= 0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLookupOrder() {
|
||||
class TestSQLErrorCodesFactory extends SQLErrorCodesFactory {
|
||||
@@ -297,6 +314,12 @@ public class SQLErrorCodesFactoryTests {
|
||||
assertIsEmpty(sec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHanaIsRecognizedFromMetadata() throws Exception {
|
||||
SQLErrorCodes sec = getErrorCodesFromDataSource("SAP DB", null);
|
||||
assertIsHana(sec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that wild card database name works.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user