Discussion:
converting JAVA calls to be ASA9-compatible
(too old to reply)
Erik Anderson
2004-02-07 01:29:24 UTC
Permalink
I am attempting to convert our database structures to use the new EXTERNAL
LANGUAGE JAVA call methodology, instead of just calling the java objects
directly. Server machine is ASA 8.0.2.4322.

(1): I have successfully converted two java functions so far, but they both
immediately throw exceptions when they are called. I'm hoping this issue
can be answered here before I start creating java test objects to try to
isolate this issue.

For instance, the command:
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
will return -1, but the following command:
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4)) RETURNS
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also occurred with
the only other signature I've gotten to work so far.

(2) What signature do I use for 'final' ? For instance, the java signature:
public static float staticFindPTTM(final String WorkSet, final String
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Preston
2004-02-09 16:02:45 UTC
Permalink
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new EXTERNAL
LANGUAGE JAVA call methodology, instead of just calling the java objects
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but they both
immediately throw exceptions when they are called. I'm hoping this issue
can be answered here before I start creating java test objects to try to
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4)) RETURNS
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also occurred with
the only other signature I've gotten to work so far.
public static float staticFindPTTM(final String WorkSet, final String
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Erik Anderson
2004-02-09 17:41:42 UTC
Permalink
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled exception
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new EXTERNAL
LANGUAGE JAVA call methodology, instead of just calling the java objects
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but they
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping this issue
can be answered here before I start creating java test objects to try to
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4)) RETURNS
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also occurred
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the java
public static float staticFindPTTM(final String WorkSet, final String
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Preston
2004-02-09 18:36:45 UTC
Permalink
I seem to remember having the same problem when I was trying this stuff. I
finally just went through the example in the readme a few times a figured
out what I was doing wrong.

Have you been through the readme?
Post by Erik Anderson
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled exception
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new
EXTERNAL
Post by Preston
Post by Erik Anderson
LANGUAGE JAVA call methodology, instead of just calling the java objects
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but they
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping this
issue
Post by Preston
Post by Erik Anderson
can be answered here before I start creating java test objects to try to
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4)) RETURNS
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also occurred
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the java
public static float staticFindPTTM(final String WorkSet, final String
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Erik Anderson
2004-02-09 18:53:51 UTC
Permalink
Not really. I've searched through the ASA9 help file a couple times, but
the only stuff I'm finding only tells you how to do it in the ASA8-style.
The only information I've really found was in the CREATE PROCEDURE
definitions.
Post by Preston
I seem to remember having the same problem when I was trying this stuff. I
finally just went through the example in the readme a few times a figured
out what I was doing wrong.
Have you been through the readme?
Post by Erik Anderson
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled exception
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new
EXTERNAL
Post by Preston
Post by Erik Anderson
LANGUAGE JAVA call methodology, instead of just calling the java
objects
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but they
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping this
issue
Post by Preston
Post by Erik Anderson
can be answered here before I start creating java test objects to
try
Post by Preston
to
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4)) RETURNS
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also occurred
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the java
public static float staticFindPTTM(final String WorkSet, final
String
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Preston
2004-02-09 19:42:41 UTC
Permalink
The help file really isn't any help... read the readme.. it contains all the
last minute changes, which all seem to releate to java.
Post by Erik Anderson
Not really. I've searched through the ASA9 help file a couple times, but
the only stuff I'm finding only tells you how to do it in the ASA8-style.
The only information I've really found was in the CREATE PROCEDURE
definitions.
Post by Preston
I seem to remember having the same problem when I was trying this stuff. I
finally just went through the example in the readme a few times a figured
out what I was doing wrong.
Have you been through the readme?
Post by Erik Anderson
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled exception
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new
EXTERNAL
Post by Preston
Post by Erik Anderson
LANGUAGE JAVA call methodology, instead of just calling the java
objects
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but
they
Post by Preston
Post by Erik Anderson
Post by Preston
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping this
issue
Post by Preston
Post by Erik Anderson
can be answered here before I start creating java test objects to
try
Post by Preston
to
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4))
RETURNS
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also
occurred
Post by Preston
Post by Erik Anderson
Post by Preston
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the java
public static float staticFindPTTM(final String WorkSet, final
String
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Erik Anderson
2004-02-10 02:24:54 UTC
Permalink
You're talking about readme.txt in the root of the Sybase installation,
right? It does have a general description of the changes that need to be
made before it directs the user to the help file.

Sounds like I'm gonna have to "step" my way through the java code. I hate
debugging java-in-the-database...

Thanks for your attention to this matter.
Post by Preston
The help file really isn't any help... read the readme.. it contains all the
last minute changes, which all seem to releate to java.
Post by Erik Anderson
Not really. I've searched through the ASA9 help file a couple times, but
the only stuff I'm finding only tells you how to do it in the ASA8-style.
The only information I've really found was in the CREATE PROCEDURE
definitions.
Post by Preston
I seem to remember having the same problem when I was trying this
stuff.
Post by Preston
I
Post by Erik Anderson
Post by Preston
finally just went through the example in the readme a few times a
figured
Post by Erik Anderson
Post by Preston
out what I was doing wrong.
Have you been through the readme?
Post by Erik Anderson
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled exception
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the new
EXTERNAL
Post by Preston
Post by Erik Anderson
LANGUAGE JAVA call methodology, instead of just calling the java
objects
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far, but
they
Post by Preston
Post by Erik Anderson
Post by Preston
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping
this
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
issue
Post by Preston
Post by Erik Anderson
can be answered here before I start creating java test objects to
try
Post by Preston
to
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4))
RETURNS
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also
occurred
Post by Preston
Post by Erik Anderson
Post by Preston
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the java
public static float staticFindPTTM(final String WorkSet, final
String
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
Erik Anderson
2004-02-10 02:45:20 UTC
Permalink
Okay, found the issue. The SQLException that was being thrown was
"Permission Denied". The SP call has a different permission profile than
the direct java call does.

Thanks for your help, ready for the next showstopper...
Post by Erik Anderson
You're talking about readme.txt in the root of the Sybase installation,
right? It does have a general description of the changes that need to be
made before it directs the user to the help file.
Sounds like I'm gonna have to "step" my way through the java code. I hate
debugging java-in-the-database...
Thanks for your attention to this matter.
Post by Preston
The help file really isn't any help... read the readme.. it contains all
the
Post by Preston
last minute changes, which all seem to releate to java.
Post by Erik Anderson
Not really. I've searched through the ASA9 help file a couple times,
but
Post by Preston
Post by Erik Anderson
the only stuff I'm finding only tells you how to do it in the
ASA8-style.
Post by Preston
Post by Erik Anderson
The only information I've really found was in the CREATE PROCEDURE
definitions.
Post by Preston
I seem to remember having the same problem when I was trying this
stuff.
Post by Preston
I
Post by Erik Anderson
Post by Preston
finally just went through the example in the readme a few times a
figured
Post by Erik Anderson
Post by Preston
out what I was doing wrong.
Have you been through the readme?
Post by Erik Anderson
Error at line 1
Procedure 'staticGetDefaultTarget' terminated with unhandled
exception
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
'java.sql.SQLException'
Post by Preston
Can you post the exception?
Post by Erik Anderson
I am attempting to convert our database structures to use the
new
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
EXTERNAL
Post by Preston
Post by Erik Anderson
LANGUAGE JAVA call methodology, instead of just calling the java
objects
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
directly. Server machine is ASA 8.0.2.4322.
(1): I have successfully converted two java functions so far,
but
Post by Preston
Post by Erik Anderson
they
Post by Preston
Post by Erik Anderson
Post by Preston
both
Post by Erik Anderson
immediately throw exceptions when they are called. I'm hoping
this
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
issue
Post by Preston
Post by Erik Anderson
can be answered here before I start creating java test objects
to
Post by Preston
Post by Erik Anderson
try
Post by Preston
to
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
isolate this issue.
select
com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget('SCHD')
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
GRANT CONNECT TO java;
CREATE FUNCTION java.getDefaultTarget(in WorkSet varchar(4))
RETURNS
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
integer
EXTERNAL NAME
'com.teamwork.analysis.ResourceTargetSpread.staticGetDefaultTarget
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
(Ljava/lang/String;)I'
LANGUAGE JAVA;
select java.getDefaultTarget('SCHD')
will throw an SQLException. This exact same symptom has also
occurred
Post by Preston
Post by Erik Anderson
Post by Preston
with
Post by Erik Anderson
the only other signature I've gotten to work so far.
(2) What signature do I use for 'final' ? For instance, the
java
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
public static float staticFindPTTM(final String WorkSet, final
String
Post by Erik Anderson
Post by Preston
Post by Erik Anderson
whereClause, final Timestamp toDate)
throws SQLException
does NOT convert to
(Ljava/lang/String;Ljava/lang/String;Ljava/sql/Timestamp)I
and i think it might be the 'final' stuff messing things up.
r***@gmail.com
2013-10-04 11:40:31 UTC
Permalink
Good Question if you have any questions like this better to prefer <a href="http://123trainings.com/it-adv-java-online-training.html">Java Online Training</a>
Loading...