Re: Calling a UDF in informix from a Java App
Posted in 2003
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Server Administration, Security, Permissions & Auditing, Data Types & Schema Design, Java & JDBC Development
try using
CallableStatement s = connection.prepareCall("{call ? =
sp_search(?,?)}");
I think when you don't specify '? =' then JDBC/IDS will try to resolve
sp_search() as a 'procedure' rather than a 'function'
Prasad
"Dwain" <Clever_glove@hotmail.com> wrote in message news:<vdpj2oa0u0it0e@corp.supernews.com>...
> I'm having a small problem calling a UDF, in a informix DB. I can call SP's
> fine, but I get a "java.sql.SQLException: Routine (sp_test) can not be
> resolved" when I attempt to call the UDF.
>
> Code as follows
>
> Java app code
> ---------
> CallableStatement s = connection.prepareCall("{call sp_search(?,?)}");
> s.setString(1, "text parm1");
> s.setString(2, "text parm2");
> ResultSet rs = s.executeQuery();
>
>
> informix Reg
> --------------
> CREATE FUNCTION sp_test(lvarchar, lvarchar)> RETURNS lvarchar
> WITH (iterator, STACK = 64)
> EXTERNAL NAME '/u/dwainc/java/crystal/iiug/bin/exec.bld(run_Test)'
> LANGUAGE C not variant;
>
> GRANT EXECUTE ON FUNCTION sp_test(lvarchar, lvarchar) TO PUBLIC;>
> If I change it to a SP it is found, it only dosen't find the procedure when
> it's a UDF. I can run this UDF from within DBACCESS.
>
> It only doesn't find it from my Java app, using JDBC.
>
> What's the magic to making this call work?
>
> Thank you for your help,
> Dwain