Thread: Function Error

Function Error

From
Susan M Farley
Date:
I'm trying to import a function in Java, but am having problems with it. The java function is

public static double chi2cdf (double x)
{
  return chi.cdf(x);
}

I copied the sim.class file to the Postgres data directory and I added it to Postgres with the following
select sqlj.replace_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim',true);

SELECT sqlj.set_classpath('public', 'sim');

CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
                 RETURNS double precision
                 AS 'simpleMonteCarlo.sim.chi2cdf'
                 LANGUAGE java;

When I try to run it, I get the following error:
ERROR:  Unable to find static method simpleMonteCarlo.sim.chi2cdf with signature (D)D

I thought it was the signature of double precision, but then tried it with two other functions, one a float and one a
int.Does anyone have any ideas? 

Thank you,
Susan



Re: Function Error

From
Michael Wood
Date:
On 23 February 2010 16:58, Susan M Farley <sfarley1@gmu.edu> wrote:
> I'm trying to import a function in Java, but am having problems with it. The java function is
>
> public static double chi2cdf (double x)
> {
>  return chi.cdf(x);
> }
>
> I copied the sim.class file to the Postgres data directory and I added it to Postgres with the following
> select sqlj.replace_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim',true);
>
> SELECT sqlj.set_classpath('public', 'sim');
>
> CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
>                 RETURNS double precision
>                 AS 'simpleMonteCarlo.sim.chi2cdf'
>                 LANGUAGE java;
>
> When I try to run it, I get the following error:
> ERROR:  Unable to find static method simpleMonteCarlo.sim.chi2cdf with signature (D)D
>
> I thought it was the signature of double precision, but then tried it with two other functions, one a float and one a
int.Does anyone have any ideas? 

Just a guess, but what happens when you use Doubles instead of doubles?  i.e.:

public static Double chi2cdf (Double x)
{
    return chi.cdf(x);
}

--
Michael Wood <esiotrot@gmail.com>