Also, you could do one of the following within the Userfunction:

1) definstance your ResultSet object.
2) definstance application specific objects based on the data in your
ResultSet.
3) assert the ResultSet data/rows as facts.

#1 is pretty useless as you can't pattern match against the row data and
would have to use jess code to extract the data - java is probably a better
tool for that job so your Userfunction is a good place to do it.

#2 is better but has more overhead than #3 and requires that you create
object wrappers for your table/query data. My guess is that your data is
static (for the purposes of this problem) and using java object wrappers
doesn't buy you anything...

#3 is more jess-like and since it is pretty simple to write a generic
Userfunction that covers arbitrary tables/query results I would go with this
approach.

Good luck!

alan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 5:32 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: JDBC ResultSet data


I think Aalap Parikh wrote:
> Hi everybody,
> 
> I am a Jess newbie. I am trying to retrieve data from
> a database by wrapping the necessary JDBC code within 
> a Userfunction.
> 
> My problem is that how do I pass the JDBC ResultSet
> containing the data to Jess? I am trying to do this
> because I want the data extracted from the database to
> be accessible for transformation or modification to a
> jess rule. 
> 
> I tried looking at store , fetch etc...But I am
> confused.
> 


If you're writing a Userfunction, you can just return a Java object to
Jess via "return":

        return new Value(myResultSet);

and this becomes the return value of the called function.


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to