【问题标题】:Caused by: org.h2.jdbc.JdbcSQLException: Function "TO_TIMESTAMP" not found; SQL statement:原因:org.h2.jdbc.JdbcSQLException:找不到函数“TO_TIMESTAMP”; SQL 语句:
【发布时间】:2022-02-18 02:33:57
【问题描述】:

有人能帮我解决吗?运行 DML 命令时出现以下错误。

原因:org.h2.jdbc.JdbcSQLException:找不到函数“TO_TIMESTAMP”; SQL语句:

【问题讨论】:

    标签: h2


    【解决方案1】:

    最后我得到了这个答案,我们在项目中使用的是旧版本的 h2 数据库依赖项。 为了快速修复,取出最新的依赖项并添加到您的 pom.xml 文件中。

    <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.195</version>
     </dependency>
    
    1. http://www.h2database.com/html/download.html
    2. https://mvnrepository.com/artifact/com.h2database/h2

    【讨论】:

      【解决方案2】:

      在将 h21.4.2 升级到 2.2.202 时,我遇到了类似的异常 (org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "TO_TIMESTAMP" not found)

      我不知道为什么,但似乎该功能已被删除

      为了让它工作,我用parsedatetime替换了to_timestamp

      parsedatetime 遵循java.text.SimpleDataFormat 语义


      编辑:另一种方法是将兼容模式添加到 Oracle (Mode=Oracle):

      spring boot 示例:https://stackoverflow.com/a/64799048/1546137

      【讨论】:

        猜你喜欢
        • 2017-12-10
        • 2013-07-26
        • 2016-12-06
        • 2019-09-28
        • 1970-01-01
        • 2015-10-19
        • 1970-01-01
        • 2022-11-16
        • 2022-06-22
        相关资源
        最近更新 更多