Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004

    Unanswered: Problem with java stored procedure ASA 9

    Trying to upgrade to ASA

    This all worked great under 7.0.4.xxxx, and there have been no changes
    to the java .jar file, or the classes inside it.

    I'm going nuts trying to get my java procedures to work, even in the
    simplest test case. I have no problem with the asademo examples, so I
    know java is installed properly. I don't have an .init method, but am
    rather trying to just call a method in one of the classes. I have
    verified the capitalization in the class and method names, but I'm not
    totally sure about the method signature. The error I'm getting is
    "Procedure 'setCylLength' not found SQLCODE=-265, ODBC 3 State="42S02""

    According to the OLH, this can mean either the procedure actually
    doesn't exist, or the number or type of parameters is incorrect. I'm
    guessing it's the latter issue, but have wasted too many hours and still
    can't find the problem. Again, note that it all worked fine in 7.0.4,
    and the asademo java examples work fine in this 9.0.1 database. It must
    be something really stupid I'm missing, but I've been looking at it so
    long I probably can't see what's really there any more.

    Any idea what I'm missing?

    Here are various pieces of my code; if you want to see the entire .java
    file, I can post it as well:

    This is the code for the method I'm trying to use, from in
    wra.util; you see that it takes a double as a parameter:

    public void setCylLength(double newCylLength) {
    cylLength = newCylLength;

    The ISQL call I'm making:

    call testsetcyllength()

    The definition of testSetCylLength():

    ALTER FUNCTION "DBA"."testSetCylLength"( )
    call SQLSetCylLength(cast(320.0 as double));
    RETURN 320;

    The definition of SQLSetCylLength():

    ALTER PROCEDURE "DBA"."SQLSetCylLength"(in arg1 double) external name
    'wra.util.Tank.setCylLength (D)V' language java

    Any suggestions or links to more info gratefully accepted!


  2. #2
    Join Date
    Aug 2004
    I had posted a bunch of plaitive cries for help with java stored
    procedure in various newsgroups over the last 3 weeks or so with few
    definitive answers, but I finally got it resolved. Maybe other people
    can learn from our pain if they run into some of the same issues.

    There were several things at work here:

    1. We were trying to access the properties of java objects from ASA
    stored procedures, which (I finally realized) had been deprecated; from
    reading the information about the changes in ASA 9, I thought that the
    only capability lost was the ability to store java objects in tables.
    This necessitated adding some additional java routines to our .jar file
    in order to wrap some of those objects in other function calls. Not too
    difficult, but it took a while for the java programmer to figure out how
    to modify the database connection code to work internal to the database,
    when it was designed from the ground up to connect from outside it.

    I am glad to see that the method of using java stored procs is becoming
    an industry standard. Sybase's syntax and options are slightly from
    some of the other vendors', but the basics are there, and there is a
    load of stuff on the web for using java with DB2.

    2. At times I was not using the correct options when compiling the
    .java files; at first I hadn't noticed that "-target 1.1" was REQUIRED,
    even when installing support for 1.3. Before that, I had been jumping
    back and forth, trying different things to see what would happen.

    3. (and most aggravating) I thought that I had to stop and restart
    the database engine after many of the updates to my java procedures, in
    order for the changes to function properly. I never figured out what
    types of changes required restarting the database and which did not, but
    I just got into the habit of doing it every time. It greatly slowed
    down my debugging cycle, but at least I could get consistent behavior.
    Then today, to my great chagrin, I discovered that simply issuing a STOP
    JAVA followed by a START JAVA would have done what I needed.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts