SQL-ERROR-CODE
개발언어/Java, Spring 2017. 12. 12. 11:50
여러 DBMS에서 발생하는 SQL 오류는 Duplicate Key, Bad Grammer Code 등 공통적인 부분이 많습니다.
그러나 솔루션마다 제공되는 오류코드가 달라 사용하는 DBMS마다 달라져야 하는데
스프링에서는 이 문제를 해결하기 위해 각 DB별로 오류코드를 매핑하여 제공합니다.
앞으로 필요할때 참고하기 위해 작성합니다.
직접 보고 싶으면 org.springframework.jdbc.support.sql-error-codes.xml 을 참고하시면 됩니다.
sql-error-codes.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | <!--?xml version="1.0" encoding="UTF-8"?--> <!-- - Default SQL error codes for well-known databases. - Can be overridden by definitions in a "sql-error-codes.xml" file - in the root of the class path. - - If the Database Product Name contains characters that are invalid - to use in the id attribute (like a space) then we need to add a property - named "databaseProductName"/"databaseProductNames" that holds this value. - If this property is present, then it will be used instead of the id for - looking up the error codes based on the current database. --> < beans > < bean id = "DB2" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductName" > < value >DB2*</ value > </ property > < property name = "badSqlGrammarCodes" > < value >-007,-029,-097,-104,-109,-115,-128,-199,-204,-206,-301,-408,-441,-491</ value > </ property > < property name = "duplicateKeyCodes" > < value >-803</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >-407,-530,-531,-532,-543,-544,-545,-603,-667</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >-904,-971</ value > </ property > < property name = "transientDataAccessResourceCodes" > < value >-1035,-1218,-30080,-30081</ value > </ property > < property name = "deadlockLoserCodes" > < value >-911,-913</ value > </ property > </ bean > < bean id = "Derby" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductName" > < value >Apache Derby</ value > </ property > < property name = "useSqlStateForTranslation" > < value >true</ value > </ property > < property name = "badSqlGrammarCodes" > < value >42802,42821,42X01,42X02,42X03,42X04,42X05,42X06,42X07,42X08</ value > </ property > < property name = "duplicateKeyCodes" > < value >23505</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >22001,22005,23502,23503,23513,X0Y32</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >04501,08004,42Y07</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >40XL1</ value > </ property > < property name = "deadlockLoserCodes" > < value >40001</ value > </ property > </ bean > < bean id = "H2" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "badSqlGrammarCodes" > < value >42000,42001,42101,42102,42111,42112,42121,42122,42132</ value > </ property > < property name = "duplicateKeyCodes" > < value >23001,23505</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >22001,22003,22012,22018,22025,23000,23002,23003,23502,23503,23506,23507,23513</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >90046,90100,90117,90121,90126</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >50200</ value > </ property > </ bean > < bean id = "HSQL" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductName" > < value >HSQL Database Engine</ value > </ property > < property name = "badSqlGrammarCodes" > < value >-22,-28</ value > </ property > < property name = "duplicateKeyCodes" > < value >-104</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >-9</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >-80</ value > </ property > </ bean > < bean id = "Informix" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductName" > < value >Informix Dynamic Server</ value > </ property > < property name = "badSqlGrammarCodes" > < value >-201,-217,-696</ value > </ property > < property name = "duplicateKeyCodes" > < value >-239,-268,-6017</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >-692,-11030</ value > </ property > </ bean > < bean id = "MS-SQL" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductName" > < value >Microsoft SQL Server</ value > </ property > < property name = "badSqlGrammarCodes" > < value >156,170,207,208,209</ value > </ property > < property name = "permissionDeniedCodes" > < value >229</ value > </ property > < property name = "duplicateKeyCodes" > < value >2601,2627</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >544,8114,8115</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >4060</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >1222</ value > </ property > < property name = "deadlockLoserCodes" > < value >1205</ value > </ property > </ bean > < bean id = "MySQL" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "badSqlGrammarCodes" > < value >1054,1064,1146</ value > </ property > < property name = "duplicateKeyCodes" > < value >1062</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >630,839,840,893,1169,1215,1216,1217,1364,1451,1452,1557</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >1</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >1205</ value > </ property > < property name = "deadlockLoserCodes" > < value >1213</ value > </ property > </ bean > < bean id = "Oracle" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "badSqlGrammarCodes" > < value >900,903,904,917,936,942,17006,6550</ value > </ property > < property name = "invalidResultSetAccessCodes" > < value >17003</ value > </ property > < property name = "duplicateKeyCodes" > < value >1</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >1400,1722,2291,2292</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >17002,17447</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >54,30006</ value > </ property > < property name = "cannotSerializeTransactionCodes" > < value >8177</ value > </ property > < property name = "deadlockLoserCodes" > < value >60</ value > </ property > </ bean > < bean id = "PostgreSQL" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "useSqlStateForTranslation" > < value >true</ value > </ property > < property name = "badSqlGrammarCodes" > < value >03000,42000,42601,42602,42622,42804,42P01</ value > </ property > < property name = "duplicateKeyCodes" > < value >23505</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >23000,23502,23503,23514</ value > </ property > < property name = "dataAccessResourceFailureCodes" > < value >53000,53100,53200,53300</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >55P03</ value > </ property > < property name = "cannotSerializeTransactionCodes" > < value >40001</ value > </ property > < property name = "deadlockLoserCodes" > < value >40P01</ value > </ property > </ bean > < bean id = "Sybase" class = "org.springframework.jdbc.support.SQLErrorCodes" > < property name = "databaseProductNames" > < list > < value >Sybase SQL Server</ value > < value >SQL Server</ value > < value >Adaptive Server Enterprise</ value > < value >ASE</ value > <!-- name as returned by jTDS driver --> < value >sql server</ value > <!-- name as returned by jTDS driver --> </ list > </ property > < property name = "badSqlGrammarCodes" > < value >101,102,103,104,105,106,107,108,109,110,111,112,113,116,120,121,123,207,208,213,257,512</ value > </ property > < property name = "duplicateKeyCodes" > < value >2601,2615,2626</ value > </ property > < property name = "dataIntegrityViolationCodes" > < value >233,511,515,530,547,2615,2714</ value > </ property > < property name = "transientDataAccessResourceCodes" > < value >921,1105</ value > </ property > < property name = "cannotAcquireLockCodes" > < value >12205</ value > </ property > < property name = "deadlockLoserCodes" > < value >1205</ value > </ property > </ bean > </ beans > |
'개발언어 > Java, Spring' 카테고리의 다른 글
Java Library: Lombok (자동 getter&setter 생성) (0) | 2017.12.21 |
---|---|
Interceptor에서 RedirectAttributes 이용하기 (0) | 2017.12.12 |
[Spring] MesageSource 설정하기 - 공통 메시지 처리 (with 다국어처리) (1) | 2017.11.27 |
[설정] 오류 공통 페이지 설정 (0) | 2017.11.26 |
Spring - AOP를 이용한 트랜잭션 처리 (0) | 2017.11.21 |