db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew McIntyre" <mcintyr...@gmail.com>
Subject Re: 'SYSCS_UTIL.SYSCS_EXPORT_QUERY' is not recognized as a function or procedure.
Date Tue, 18 Jul 2006 17:21:26 GMT
On 7/18/06, Sharath <sharath.babuk@gmail.com> wrote:
>
> 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.
>
> </snip>
>
>     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()");
>         }
> </snip>
> Aby idea..?

Without seeing your StoredProcedure class or knowing the exception
that was thrown, my suggestion would be to make sure the SQL contains
the CALL keyword as well as the parameter markers. So in this case the
SQL should be: "CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY VALUES (?, ?, ?, ?,
?)"

There are some JDBC examples of calling the Derby stored procedures in
some of the other descriptions of the stored procedures. If you could
post your StoredProcedure class and/or the exception that you get when
trying to run your example, I might be able to provide more insight
into why it is failing.

thanks,
andrew

Mime
View raw message