gpt4 book ai didi

java - Spring - sql-error-codes.xml 错误代码映射文件中的 Ingres RDBMS 支持

转载 作者:行者123 更新时间:2023-12-01 16:09:58 24 4
gpt4 key购买 nike

我有一个连接到 Ingres 数据库并使用 Spring 框架的 Java 项目。该问题与错误码列表配置有关。

根据Spring Framework API :

Class SQLErrorCodes: JavaBean for holding JDBC error codes for a particular database. Instances of this class are normally loaded through a bean factory.

Used by Spring's SQLErrorCodeSQLExceptionTranslator. The file "sql-error-codes.xml" in this package contains default SQLErrorCodes instances for various databases.

默认文件捆绑在 spring.jar 中,不包含与 Ingres RDBMS 相关的错误代码,其位置为 org/springframework/jdbc/support/sql-error-codes.xml

附录 D:SQLSTATE 值和通用错误代码中的本文档“Ingres 2006 SQL Reference Guide”包含 Ingres RDBMS 错误代码的完整列表。

包含 Ingress 错误代码的 sql-error-codes.xml 文件的唯一相关示例是 one :

引用:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<!--
- 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="INGRES" class="org.springframework.jdbc.support.SQLErrorCodes">
<property name="useSqlStateForTranslation">
<value>true</value>
</property>
<property name="badSqlGrammarCodes">
<value>22000,26000,42000,42500,42501,50000,5000A</value>
</property>
<property name="invalidResultSetAccessCodes">
<value>24000</value>
</property>
<property name="dataIntegrityViolationCodes">
<value>23500,23501,23502</value>
</property>
<property name="dataAccessResourceFailureCodes">
<value>08001</value>
</property>
<property name="cannotAcquireLockCodes">
<value>5000R</value>
</property>
<property name="cannotSerializeTransactionCodes">
<value>40001</value>
</property>
<property name="deadlockLoserCodes">
<value>40P01</value>
</property>
</bean>

</beans>

有人可以建议一个更新且完整的版本吗?

最佳答案

9.3 SQLState代码可以从docs.ingres.com获取。与提交 JIRA ticket 的人交谈没有进一步的更新。大多数错误都使用适当的异常类型进行处理。与 PostgreSQL 配置文件类似。

关于java - Spring - sql-error-codes.xml 错误代码映射文件中的 Ingres RDBMS 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1637385/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com