db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sharath <sharath.ba...@gmail.com>
Subject 'SYSCS_UTIL.SYSCS_EXPORT_QUERY' is not recognized as a function or procedure.
Date Tue, 18 Jul 2006 12:15:04 GMT
Hi all,
I wanted to export query reslut to a CSV file.
When i run 'SYSCS_UTIL.SYSCS_EXPORT_QUERY'  with all parameters it working
fine from ij>.

But when i run this from java it trhowing me the exception.


  void test() {
        DriverManagerDataSource ds = new DriverManagerDataSource();
        ds.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
        ds.setUrl("jdbc:derby:C:/projects/S2oSandBox/sm/SMdirect");
        ds.setUsername("sa");
        ds.setPassword("");

        new MyStoredProcedure(ds).export("select * from sm_event",
            "c:/projects/awards.txt", ',', ',', "UTF-8");

    }

    private class MyStoredProcedure extends StoredProcedure {
        MyStoredProcedure(DataSource ds) {
            logger.info("eventLogQuery constructor");
            setDataSource(ds);
            setFunction(true);
            setSql("SYSCS_UTIL.SYSCS_EXPORT_QUERY");
            logger.info("eventLogQuery setSql(SQL)");
            declareParameter(new SqlParameter("query", Types.VARCHAR));
            declareParameter(new SqlParameter("path", Types.VARCHAR));
            // You'll have to use the right types here
            declareParameter(new SqlParameter("notUsed1", Types.CHAR));
            declareParameter(new SqlParameter("notUsed2", Types.CHAR));
            declareParameter(new SqlParameter("notUsed3", Types.VARCHAR));
            compile();
            logger.info("eventLogQuery compile()");
        }

        public void export(String query, String path, char notUsed1,
                char notUsed2, String notUsed3) {
            Map inParams = new HashMap();
            // Better to use constants for the param names here and above
            inParams.put("query", query);
            inParams.put("path", path);
            inParams.put("notUsed1", notUsed1);
            inParams.put("notUsed2", notUsed2);
            inParams.put("notUsed3", notUsed3);
            execute(inParams); // calls superclass
        }
Aby idea..?

-- 
Thnx & Regards
Sharath

Mime
View raw message