Spring JDBC与Derby存储过程

时间:2010-09-29 22:37:27

标签: stored-procedures derby spring-jdbc

Derby文档syscs_util.syscs_backup_database。

我做了以下琐碎的课程:

public class DerbyMemoryDatabaseDumpDao extends JdbcDaoSupport {
    private SimpleJdbcCall caller;

    @PostConstruct
    public void initialize() {
        caller = new SimpleJdbcCall(getDataSource()).withCatalogName("SYSCS_UTIL")
            .withProcedureName("SYSCS_BACKUP_DATABASE");
    }

    public void dumpDatabase(String whereTo) {
        SqlParameterSource in = new MapSqlParameterSource().addValue("BACKUPDIR", whereTo);
        caller.execute(in);

    }
}

并且得到了以下指示:Spring JDBC 3.0.4无法理解这种情况。我看不出如何使用位置?为此目的,甚至只是将参数硬编码到调用中(虽然我几乎没有划过那个表面)。

2258 [main] DEBUG org.springframework.jdbc.core.metadata.CallMetaDataProviderFactory  - Using org.springframework.jdbc.core.metadata.DerbyCallMetaDataProvider
2258 [main] DEBUG org.springframework.jdbc.core.metadata.CallMetaDataProvider  - Retrieving metadata for null/SA/SYSCS_BACKUP_DATABASE
2862 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils  - Returning JDBC Connection to DataSource
2863 [main] DEBUG org.springframework.jdbc.core.simple.SimpleJdbcCall  - Compiled stored procedure. Call string is [{call SYSCS_UTIL.SYSCS_BACKUP_DATABASE()}]
2863 [main] DEBUG org.springframework.jdbc.core.simple.SimpleJdbcCall  - SqlCall for procedure [SYSCS_BACKUP_DATABASE] compiled
2864 [main] DEBUG org.springframework.jdbc.core.metadata.CallMetaDataContext  - Matching [BACKUPDIR] with []
2864 [main] DEBUG org.springframework.jdbc.core.metadata.CallMetaDataContext  - Found match for []
2865 [main] DEBUG org.springframework.jdbc.core.simple.SimpleJdbcCall  - The following parameters are used for call {call SYSCS_UTIL.SYSCS_BACKUP_DATABASE()} with: {}
2866 [main] DEBUG org.springframework.jdbc.core.JdbcTemplate  - Calling stored procedure [{call SYSCS_UTIL.SYSCS_BACKUP_DATABASE()}]
2866 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils  - Fetching JDBC Connection from DataSource
2866 [main] DEBUG org.springframework.jdbc.datasource.SimpleDriverDataSource  - Creating new JDBC Driver Connection to [jdbc:derby:memory:testdb;create=true]

1 个答案:

答案 0 :(得分:0)

尽管提示添加.withCatalog的错误消息,但解决方法是.withSchema,而不是。