0

我正在使用最新版本的 H2,即 1.3.150 版,并且在更新 VARCHAR2 时得到 org.h2.jdbc.JdbcSQLException。

  • SQL语句很简单

    UPDATE STAMP_TABLE SET DESCRIPTION='a bit of text' WHERE STAMPID='s/1'

  • 而表本身并没有什么特别之处,就是一堆 VARCHAR2 和一个 BLOB

  • 它第一次工作,第二次失败并显示错误消息:

    Error while renaming file "C:\my\local\path\1.t6.lob.db" to "C:\my\local\path\1.temp.lob.db"

  • 使用 SQL 语句的方法如下:

    public void updateStampDescription(StampId stampId, String description) throws SQLException {
    
        PreparedStatement stmt = null;
    
        try {
    
            stmt = conn.prepareStatement(UPDATE_STAMP_DESCRIPTION);
            stmt.setString(1, description);
            stmt.setString(2, stampId.getId());
    
            logger.debug("SQL statement: " + stmt.toString());
    
            stmt.execute();
    
        }
        catch(SQLException ex){
            logger.error("Error while updating table " + STAMPS_TABLE_NAME + ", description column: " + ex.getMessage() );
            ex.printStackTrace();
            throw ex;
        }
        finally {
            if(stmt!=null) stmt.close(); // Also closes the ResultSet
        }
    
    }
    

知道有什么问题吗?

4

1 回答 1

0

我会回答我自己的问题:

实际上,该项目位于 Dropbox 文件夹中,当时 Dropbox 正在使用这些文件,因此无法按照 H2 的要求重命名。

于 2011-02-03T10:52:36.347 回答