views:

22

answers:

1

Derby documents syscs_util.syscs_backup_database.

I made the following trivial class:

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);

    }
}

And was rewarded with the following indication that Spring JDBC 3.0.4 is failing to make sense of the situation. I can't see how to just use a positional ? for this purpose, or even to just hard-code the parameter into the call (though I've barely scratched that surface).

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]
A: 

In spite of the error message which suggested adding .withCatalog, the solution to this was .withSchema, instead.

bmargulies