By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,504 Members | 1,884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,504 IT Pros & Developers. It's quick & easy.

Inconsistent behaviour creating java stored objects using sqlplus in Oracle 8i

P: n/a
I'm new to Java but experienced with PL/SQL. I've found what appears to be
strange behaviour (a bug?) when attempting to create java stored objects
using the UNIX version of Oracle SQL*PLUS 8.1.7.3.0 with JServer 8.1.7.3.0.
The reason it seams strange is that the problem only occurs with the UNIX
version of SQL*PLUS, not the PC client version running on Windows 2000 but
connected to the same database and schema. Can anyone shed any light on
this? Details below.

The class below appears to be valid Java because it compiles without error
using the Sun JDK 1.4.

public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

If I attempt to create this java class as a stored object in the database I
can do this using the PC client SQL*PLUS running Windows 2000 and connect to
the database running UNIX on a Sun machine. The code is:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

I have tested this and the java works as intended in a PL/SQL application.

However, when I attempt to complile the same script using the UNIX version
of SQL*PLUS connected to the same database and schema it fails. I have
attempted to find out why it fails in the UNIX version of SQL*PLUS. When I
modify the script to attempt to isolate the problem the error messages from
the UNIX SQL*PLUS vary but appear unhelpful (for example <EOF> found where
there is no EOF). This is for code to works with the PC client version of
SQL*PLUS.

However I found some java scripts that compile in *both* the UNIX and PC
client versions of SQL*PLUS. An example of this is below:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
return Number1 & Number2; }
catch (Exception e) {
return -1; }
}
};

Any ideas why the apparent inconsistent behaviour between the UNIX and
PC-client versions of SQL*PLUS?

Matt
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Matt" <no*@this.address.com> wrote in message news:<40**********************@news.optusnet.com.a u>...
I'm new to Java but experienced with PL/SQL. I've found what appears to be
strange behaviour (a bug?) when attempting to create java stored objects
using the UNIX version of Oracle SQL*PLUS 8.1.7.3.0 with JServer 8.1.7.3.0.
The reason it seams strange is that the problem only occurs with the UNIX
version of SQL*PLUS, not the PC client version running on Windows 2000 but
connected to the same database and schema. Can anyone shed any light on
this? Details below.

The class below appears to be valid Java because it compiles without error
using the Sun JDK 1.4.

public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

If I attempt to create this java class as a stored object in the database I
can do this using the PC client SQL*PLUS running Windows 2000 and connect to
the database running UNIX on a Sun machine. The code is:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

I have tested this and the java works as intended in a PL/SQL application.

However, when I attempt to complile the same script using the UNIX version
of SQL*PLUS connected to the same database and schema it fails. I have
attempted to find out why it fails in the UNIX version of SQL*PLUS. When I
modify the script to attempt to isolate the problem the error messages from
the UNIX SQL*PLUS vary but appear unhelpful (for example <EOF> found where
there is no EOF). This is for code to works with the PC client version of
SQL*PLUS.

However I found some java scripts that compile in *both* the UNIX and PC
client versions of SQL*PLUS. An example of this is below:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
return Number1 & Number2; }
catch (Exception e) {
return -1; }
}
};

Any ideas why the apparent inconsistent behaviour between the UNIX and
PC-client versions of SQL*PLUS?

Matt


it may have something to do with sqlplus wanting to use the & for
variable substitution. try issuing a

set scan off

in sqlplus before executing the create or replace java source ...
statement.
Jul 19 '05 #2

P: n/a

"bung ho" <bu*****@hotmail.com> wrote in message
news:56*************************@posting.google.co m...
"Matt" <no*@this.address.com> wrote in message

news:<40**********************@news.optusnet.com.a u>...
I'm new to Java but experienced with PL/SQL. I've found what appears to be strange behaviour (a bug?) when attempting to create java stored objects
using the UNIX version of Oracle SQL*PLUS 8.1.7.3.0 with JServer 8.1.7.3.0. The reason it seams strange is that the problem only occurs with the UNIX version of SQL*PLUS, not the PC client version running on Windows 2000 but connected to the same database and schema. Can anyone shed any light on
this? Details below.

The class below appears to be valid Java because it compiles without error using the Sun JDK 1.4.

public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

If I attempt to create this java class as a stored object in the database I can do this using the PC client SQL*PLUS running Windows 2000 and connect to the database running UNIX on a Sun machine. The code is:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
long iReturn = Number1 & Number2;
return iReturn; }
catch (Exception e) {
return -1; }
}
};

I have tested this and the java works as intended in a PL/SQL application.
However, when I attempt to complile the same script using the UNIX version of SQL*PLUS connected to the same database and schema it fails. I have
attempted to find out why it fails in the UNIX version of SQL*PLUS. When I modify the script to attempt to isolate the problem the error messages from the UNIX SQL*PLUS vary but appear unhelpful (for example <EOF> found where there is no EOF). This is for code to works with the PC client version of SQL*PLUS.

However I found some java scripts that compile in *both* the UNIX and PC
client versions of SQL*PLUS. An example of this is below:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Mathematics" AS
public class Mathematics {
public static long lbitand (long Number1, long Number2) {
try {
return Number1 & Number2; }
catch (Exception e) {
return -1; }
}
};

Any ideas why the apparent inconsistent behaviour between the UNIX and
PC-client versions of SQL*PLUS?

Matt


it may have something to do with sqlplus wanting to use the & for
variable substitution. try issuing a

set scan off

in sqlplus before executing the create or replace java source ...
statement.


I already had issued 'set scan off', but thanks for the suggestion.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.