hi, The same code returns null on my machine. I have the following jars in my classpath. derbyclient.jar derbynet.jar derbytools.jar and the ActiveOrg.classs This is what I have for systeminfo
--------- Derby Information -------- JRE - JDBC: J2SE 5.0 - JDBC 3.0 [C:\java\derby\lib\derbyclient.jar] 10.1.2.1 - (330608) [C:\java\derby\lib\derbynet.jar] 10.1.2.1 - (330608) [C:\java\derby\lib\derbytools.jar] 10.1.2.1 - (330608) [C:\derby.jar] 10.1.3.1 - (417277) I found this link http://db.apache.org/derby/docs/10.2/ref/rrefjdbcjsr169.html that seems to suggest that jdbc:default:connection is not supported for jdbc3.0. Anyhelp is greatly appreciated. Thanks -Milind > Date: Mon, 24 Mar 2008 09:27:49 +0530 > From: [EMAIL PROTECTED] > Subject: Re: jdbc:default:connection fails > To: [email protected] > > 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
