Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Java Class Error

3 posts in General Discussion Last posting was on 2002-11-07 17:26:11.0Z
Rogelio_Quan Posted on 2002-11-07 02:47:06.0Z
From: Rogelio_Quan
Date: Wed, 6 Nov 2002 21:47:06 -0500
Newsgroups: ianywhere.public.general
Subject: Java Class Error
Message-ID: <6F2FF7CA23CDB338000F4C8285256C6A.000F4CB885256C6A@webforums>
Lines: 15
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:455
Article PK: 2276

I've been trying to start using Java in the database, and i try the example
that comes in the documentation, i loaded the java class and then i opened
the isql and i put this instructions

CREATE VARIABLA inv Invoice;
this instruction executed right

then i put
SET inv = NEW Invoice();

but i got this error

ASA Error - 762 Invoice is not a public java class

anybody have a clue of what've happened


Greg Fenton <greg.fenton Posted on 2002-11-07 16:33:35.0Z
Date: Thu, 07 Nov 2002 11:33:35 -0500
From: Greg Fenton <greg.fenton@SPAM_SPAM_GO_AWAY_ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 MultiZilla/v1.1.22
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: Re: Java Class Error
References: <6F2FF7CA23CDB338000F4C8285256C6A.000F4CB885256C6A@webforums>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <Z8itr1nhCHA.130@forums.sybase.com>
Newsgroups: ianywhere.public.general
Lines: 27
NNTP-Posting-Host: 172.31.140.220
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub ianywhere.public.general:454
Article PK: 2272


Rogelio_Quan wrote:
> I've been trying to start using Java in the database, and i try the example
> that comes in the documentation

Can you indicate where in the docs you found this example (and
which version of ASA you are using)?

Searching for "java database example invoice", I came across this
page:

Adaptive Server Anywhere Programming Guide
3. Introduction to Java in the Database
A Java seminar
- Understanding Java classes

Which, from what I read, shows that you need to create an Invoice
class yourself.

> but i got this error
>
> ASA Error - 762 Invoice is not a public java class

This error message tells me that the Invoice class was not
declared as public. In other words, is you Invoice class
declared as "class Invoice" or as "public class Invoice" ?

Maybe you can post Invoice.java ?

greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Rogelio_Quan Posted on 2002-11-07 17:26:11.0Z
From: Rogelio_Quan
Date: Thu, 7 Nov 2002 12:26:11 -0500
Newsgroups: ianywhere.public.general
Subject: Re: Java Class Error
Message-ID: <1B502D843BB9CED7005FC7E685256C6A.005F572285256C6A@webforums>
References: <6F2FF7CA23CDB338000F4C8285256C6A.000F4CB885256C6A@webforums> <Z8itr1nhCHA.130@forums.sybase.com>
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:453
Article PK: 2273

this is the code of the Invoice Class

public class Invoice {

// Fields
public String lineItem1Description;
public double lineItem1Cost;

public String lineItem2Description;
public double lineItem2Cost;

// An instance method
public double totalSum() {
double runningsum;
double taxfactor = 1 + Invoice.rateOfTaxation();

runningsum = lineItem1Cost + lineItem2Cost;
runningsum = runningsum * taxfactor;

return runningsum;
}

// A class method
public static double rateOfTaxation() {
double rate;
rate = .15;

return rate;
}
}