Milind W wrote:
Yes your right. I had to change that, forgot to update the sample.
The function does get invoked when I call it using squirrel and I see
the ActiveOrgError.txt and it does not go beyond the get connection line.
Did the jdbc:default:connection work for you or did you get any
errors for that line?
Thanks
-Milind
> Date: Sun, 23 Mar 2008 22:00:32 +0530
> From: [EMAIL PROTECTED]
> Subject: Re: jdbc:default:connection fails
> To: [email protected]
>
>
> > /*
> > Declared as follows:
> > CREATE FUNCTION GetActiveOrg (status STRING)
> > RETURNS VARCHAR(255)
> > LANGUAGE JAVA
> > PARAMETER STYLE JAVA
> > READS SQL DATA
> > EXTERNAL NAME 'com.mymunshi.derbyfunctions.ActiveOrg.GetActiveOrg'
> >
> >
> You have used the STRING datatype here, running the same command in
gives me
>
> ERROR 42X01: Syntax error: Encountered "status" at line 1, column 31.
>
> changing String to VARCHAR(20) makes this definition work.
>
> Narayanan
Hi,
I did not try your entire program but reduced it to the following
package com.myorg.derbyfunctions;
import java.sql.*;
import java.util.*;
import java.io.*;
public class ActiveOrg {
public static String GetActiveOrg(String status) throws SQLException {
Connection conn = DriverManager.getConnection
("jdbc:default:connection");
if (conn == null) {
return "null";
} else {
return "not null";
}
}
}
So if it works it is supposed to return not null
I then set my classpath to
/home/vn/work/workspaces/freshworkspace/trunk/classes:/home/vn/work/test_programs/ReturnTrueFalse/build/classes/
basically
1) the place where the derby classes are present and
2) the class I want to run is present
then did the following using ij
ij version 10.5
ij> connect 'jdbc:derby:mydb10;create=true';
ij> CREATE FUNCTION GetActiveOrg (status VARCHAR(20)) RETURNS
VARCHAR(30) LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA EXTERNAL
NAME 'com.myorg.derbyfunctions.ActiveOrg.GetActiveOrg';
0 rows inserted/updated/deleted
ij> values GetActiveOrg('hello');
1
--------------------------------------------------------------------------------------------------------------------------------
not
null
1 row selected
ij>
I get not null indicating that it works. I guess your program is just an
extension of this.
Narayanan