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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

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

    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 "Mathematic s" 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 <EOFfound 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 "Mathematic s" 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


  • bung ho

    #2
    Re: Inconsistent behaviour creating java stored objects using sqlplus in Oracle 8i

    "Matt" <not@this.addre ss.comwrote in message news:<407e1036$ 0$4543$afc38c87 @news.optusnet. com.au>...
    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 "Mathematic s" 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 <EOFfound 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 "Mathematic s" 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.

    Comment

    • Matt

      #3
      Re: Inconsistent behaviour creating java stored objects using sqlplus in Oracle 8i


      "bung ho" <bung_ho@hotmai l.comwrote in message
      news:567a1b1.04 04151047.755643 64@posting.goog le.com...
      "Matt" <not@this.addre ss.comwrote in message
      news:<407e1036$ 0$4543$afc38c87 @news.optusnet. com.au>...
      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 "Mathematic s" 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 <EOFfound
      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 "Mathematic s" 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.



      Comment

      Working...