Lists: | pljava-dev |
---|
From: | sfarley1 at gmu(dot)edu (Susan M Farley) |
---|---|
To: | |
Subject: | [Pljava-dev] Function Error |
Date: | 2010-03-24 15:34:28 |
Message-ID: | f89282645423.4ba9eab4@gmu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
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 and get similar errors. Does anyone have any ideas?
Thank you,
Susan
From: | Jon(dot)Roberts at asurion(dot)com (Roberts, Jon) |
---|---|
To: | |
Subject: | [Pljava-dev] Function Error |
Date: | 2010-03-24 16:01:30 |
Message-ID: | 8661B041D452404E8088FBD47D2443BE2532EF@NDCEXCUS703.int.asurion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
I believe the problem is the classpath. You are putting the jar in the
public schema but your function is in the sim schema. Try this:
select sqlj.remove_jar('sim', true);
select * from
sqlj.install_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim_ja
r',true);
select sqlj.set_classpath('sim', 'sim_jar');
CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
RETURNS double precision
AS 'simpleMonteCarlo.sim.chi2cdf'
LANGUAGE java;
If that isn't it, try changing the Java method to return a
java.lang.String and then have your PostgreSQL function return a
character varying. That will eliminate the possibility of a signature
problem.
Jon
-----Original Message-----
From: pljava-dev-bounces at pgfoundry.org
[mailto:pljava-dev-bounces at pgfoundry.org] On Behalf Of Susan M Farley
Sent: Wednesday, March 24, 2010 10:34 AM
To: pljava-dev at pgfoundry.org
Subject: [Pljava-dev] Function Error
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',t
rue);
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 and get similar
errors. Does anyone have any ideas?
Thank you,
Susan
--
Sent via pgsql-novice mailing list (pgsql-novice at postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
_______________________________________________
Pljava-dev mailing list
Pljava-dev at pgfoundry.org
http://pgfoundry.org/mailman/listinfo/pljava-dev
From: | tim(dot)clarke at manifest(dot)co(dot)uk (Tim Clarke) |
---|---|
To: | |
Subject: | [Pljava-dev] Function Error |
Date: | 2010-03-24 16:07:41 |
Message-ID: | 4BAA38CD.1080700@manifest.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
On 24/03/10 16:01, Roberts, Jon wrote:
> I believe the problem is the classpath. You are putting the jar in the
> public schema but your function is in the sim schema. Try this:
>
> select sqlj.remove_jar('sim', true);
> select * from
> sqlj.install_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim_ja
> r',true);
> select sqlj.set_classpath('sim', 'sim_jar');
>
> CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
> RETURNS double precision
> AS 'simpleMonteCarlo.sim.chi2cdf'
> LANGUAGE java;
>
> If that isn't it, try changing the Java method to return a
> java.lang.String and then have your PostgreSQL function return a
> character varying. That will eliminate the possibility of a signature
> problem.
>
>
> Jon
>
> -----Original Message-----
> From: pljava-dev-bounces at pgfoundry.org
> [mailto:pljava-dev-bounces at pgfoundry.org] On Behalf Of Susan M Farley
> Sent: Wednesday, March 24, 2010 10:34 AM
> To: pljava-dev at pgfoundry.org
> Subject: [Pljava-dev] Function Error
>
> 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',t
> rue);
>
> 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 and get similar
> errors. Does anyone have any ideas?
>
> Thank you,
> Susan
>
Or possibly the file itself - you said that you "copied the sim.class
file" - should you not have put a .jar file instead?
--
Tim Clarke AMBCS MIAP
IT Director
Manifest
9 Freebournes Court
Newland Street
Witham, Essex
CM8 2BL
England
Phone: +44 1376 503500
Direct: +44 1376 504510
Fax: +44 1376 503550
Email: tim.clarke at manifest.co.uk <mailto:tim.clarke at manifest.co.uk>
Web: http://www.manifest.co.uk
Skype: callto:tim.clarke
Manifest is the trading name of: Manifest Information Services Ltd: Registered in England Number 3401145 & The Manifest Voting Agency Ltd:
Registered in England Number 2920820. Registered Office at above address. VAT Registration Number: GB 700 1880 77
Copyright: This e-mail may contain confidential or legally privileged information.
If you are not the named addressee you must not use or disclose such information, instead please report it to: admin at manifest.co.uk
Please see http://www.manifest.co.uk/legal/legal_notices.htm for further information.