sqlj

From: Lai <lyekheng_at_hotmail.com>
Date: Mon, 22 Feb 1999 13:41:46 +0800
Message-ID: <36d0edd5.0_at_news.cyberway.com.sg>



Hi,

Have anybody tried translating a SQLJ application? I got the following error and don't know what is the cause. I'm newbie to sqlj.

unexpected error occurred...
java.lang.ExceptionInInitializerError: java.lang.NullPointerException

at sqlj.framework.ClassFileReader.attribute_info(Compiled Code)
at sqlj.framework.ClassFileReader.readClass(Compiled Code)
at sqlj.framework.ClassFileReader.describeClass(Compiled Code)
at sqlj.framework.ClassFileReader.getDeclaringClass(Compiled Code)
at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(Compiled Code)
at sqlj.framework.JSClass.resolveClassReferences(Compiled Code)......

The program is as follows:
/* Import SQLExceptions class. The SQLException comes from

   JDBC. Executable #sql clauses result in calls to JDBC, so methods    containing executable #sql clauses must either catch or throw    SQLException.
*/
import java.sql.SQLException ;
import oracle.sqlj.runtime.Oracle;

// iterator for the select

#sql iterator MyIter (String ITEM_NAME);

class TestInstallSQLJ
{
  //Main method
  public static void main (String args[])
{

    try

      /* if you're using a non-Oracle JDBC Driver, add a call here to    DriverManager.registerDriver() to register your Driver

      */

      // set the default connection to the URL, user, and password
      // specified in your connect.properties file
      Oracle.connect(TestInstallSQLJ.class, "connect.properties");

      TestInstallSQLJ ti = new TestInstallSQLJ();
      ti.runExample();

    } catch (SQLException e)

      System.err.println("Error running the example: " + e);     }

  } //End of method main

  //Method that runs the example
  void runExample() throws SQLException
{

      //Issue SQL command to clear the SALES table     #sql { DELETE FROM SALES };
    #sql { INSERT INTO SALES(ITEM_NAME) VALUES ('Hello, SQLJ!')};

    MyIter iter;
    #sql iter = { SELECT ITEM_NAME FROM SALES };

    while (iter.next()) {
      System.out.println(iter.ITEM_NAME());     }
  }
} Received on Mon Feb 22 1999 - 06:41:46 CET

Original text of this message