Oracle - Hello World 2001

(Windows 98; Oracle 8.1.7i Personal Edition; PL/SQL; Developer 6; Java (JDBC))


 

  • Environment:

This is a guide to set and run Oracle. It assumes the following:

  • ORACLE_HOME = E:\Oracle\Ora81
  • JAVA_HOME = D:\Program Files\jdk1.3.1_01
  • DEVELOPER_HOME = D:\Program Files\orawin95
  • DEMO_PLSQL_HOME = C:\PLSQL
  • DEMO_JDBC_HOME = C:\JDBC
  • DEMO_DEVELOPER_HOME = C:\DEVELOPER
Download the Demo sample, extract it and test it.

 

  • Oracle - Installation:

The installation media should include a file called "setup.exe" which takes launches the Oracle Universal Installer:

  • File Locations
    Destination...
    Name: OraHome81
    Path: e:\Oracle\Ora81
    
  • Available Products
    Select a product to install.
    Oracle8i Typical Installation 8.1.7.0.0 (approximately 860 megabytes)
    
  • Database Identification
    Global Database Name: orcl.world
    SID: orcl
    
  • Summary
    Click on "Install".
    

 

  • Oracle - Post-Installation:

After the installation, you may need to do the following.

  • Exit from the installation.
  • Shutdown Oracle: Start -> Programs -> Oracle - OraHome81 -> Database Administration -> Stop Database
  • Reboot the Computer
  • After rebooting the computer, the following lines may have been added to "c:\autoexec.bat":
    SET path="C:\Program Files\Oracle\jre\1.1.7\bin";"%path%";
    SET Path=e:\Oracle\Ora81\bin;"%Path%"
    

 

  • Oracle - Testing:

  • Start Oracle 8i Server from the desktop. Click on Start.
    Start -> Programs -> Oracle - OraHome81 -> Database Administration -> Start Database
    
  • Open SQL Plus from the desktop. Click on Start.
    Start -> Programs -> Oracle - OraHome81 -> Application Development -> SQL Plus
    
  • Login with SQL*Plus:
    User Name: scott
    Password: tiger
    
    Leave "Host String" blank.
  • Test by executing a database query:
    select user_tables.table_name from sys.user_tables where user='SCOTT';
    
    The output should display as the following:
    TABLE_NAME
    ------------------------------
    BONUS
    DEPT
    EMP
    LOG
    SALGRADE
    

 

  • Oracle - Preparing PL/SQL:

The following scripts will build necessary data and functions for the sample test.

  • Create "start.sql" under "c:\plsql":
    --
    -- DELETE
    --
    DELETE FROM log;
    
    --
    -- DROP
    --
    DROP TABLE log;
    
    --
    -- CREATE
    --
    CREATE TABLE log
    (
      timestamp   DATE         NOT NULL,
      host        VARCHAR2(25) NOT NULL,
      application VARCHAR2(25) NOT NULL,
      id          INT          NOT NULL,
      message     VARCHAR2(25) NOT NULL
    );
    
    --
    -- DESCRIBE
    --
    DESCRIBE log;
    
    --
    -- PL/SQL
    --
    @triggers;
    @functions;
    @procedures;
    
    --
    -- INSERT through procedure
    --
    EXEC log_test_insert;
    
    --
    -- UPDATE through procedure
    --
    EXEC log_test_update('2');
    
    --
    -- SELECT
    --
    SELECT log.* FROM scott.log;
    
  • Create "triggers.sql" under "c:\plsql":
    --
    -- log_insert_check
    --
    CREATE OR REPLACE TRIGGER log_insert_check
      BEFORE INSERT ON log
    FOR EACH ROW
    BEGIN
      IF :NEW.id > 10 THEN
        RAISE_APPLICATION_ERROR(-20000, '[log.id]' || :new.id || '.');
      END IF;
    END;
    /
    SHOW ERRORS;
    
  • Create "functions.sql" under "c:\plsql":
    --
    -- get_sysdate
    --
    CREATE OR REPLACE FUNCTION get_sysdate
      RETURN DATE
    AS
      current_sysdate DATE;
    BEGIN
      SELECT sysdate
      INTO current_sysdate
      FROM dual;
    
      RETURN current_sysdate;
    END get_sysdate;
    /
    SHOW ERRORS;
    
    --
    -- get_global_name
    --
    CREATE OR REPLACE FUNCTION get_global_name
      RETURN VARCHAR
    AS
      current_global_name VARCHAR(50);
    BEGIN
      SELECT global_name
      INTO current_global_name
      FROM global_name;
    
      RETURN current_global_name;
    END get_global_name;
    /
    SHOW ERRORS;
    
  • Create "procedures.sql" under "c:\plsql":
    --
    -- log_test_insert
    --
    CREATE OR REPLACE PROCEDURE log_test_insert IS
      current_timestamp   DATE;
      current_host        VARCHAR2(25);
      current_application VARCHAR2(25);
      current_id          NUMBER;
      current_message     VARCHAR2(25);
      counter             NUMBER;
    BEGIN
      FOR counter IN 1..10 LOOP
        current_timestamp   := get_sysdate();
        current_host        := 'localhost';
        current_application := get_global_name();
        current_id          := counter;
        current_message     := 'Hello World';
    
        INSERT INTO log (timestamp, host, application, id, message)
        VALUES
        (
          current_timestamp, current_host, current_application, current_id, current_message
        );
      END LOOP;
    
    END;
    /
    SHOW ERRORS;
    
    --
    -- log_test_update
    --
    CREATE OR REPLACE PROCEDURE log_test_update
    (
      modula_value NUMBER
    )
    IS
      CURSOR log_id_cursor IS
        SELECT log.id FROM log;
      current_id NUMBER;
    BEGIN
      OPEN log_id_cursor;
      LOOP
        FETCH log_id_cursor INTO current_id;
        EXIT WHEN log_id_cursor%NOTFOUND;
    
        IF MOD(current_id, modula_value) = 0 THEN
          UPDATE scott.log
          SET log.message='Hello World Hello World'
          WHERE log.id=current_id;
        END IF;
      END LOOP;
      CLOSE log_id_cursor;
    END;
    /
    SHOW ERRORS;
    

 

  • Oracle - Execute PL/SQL:

In SQL*Plus, click on File->Open and choose "c:\plsql\start.sql". Press Enter. The purpose of this is to change the current directory to "c:\plsql" so the PL/SQL scripts can be called.

@start.sql

The output from SQL*Plus may look like this:

SQL> @start.sql

10 rows deleted.


Table dropped.


Table created.

 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TIMESTAMP                                 NOT NULL DATE
 HOST                                      NOT NULL VARCHAR2(25)
 APPLICATION                               NOT NULL VARCHAR2(25)
 ID                                        NOT NULL NUMBER(38)
 MESSAGE                                   NOT NULL VARCHAR2(25)


Trigger created.

No errors.

Function created.

No errors.

Function created.

No errors.

Procedure created.

No errors.

Procedure created.

No errors.

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


TIMESTAMP HOST                      APPLICATION                       ID
--------- ------------------------- ------------------------- ----------
MESSAGE
-------------------------
28-NOV-01 localhost                 ORCL.WORLD                         1
Hello World

28-NOV-01 localhost                 ORCL.WORLD                         2
Hello World Hello World

28-NOV-01 localhost                 ORCL.WORLD                         3
Hello World


TIMESTAMP HOST                      APPLICATION                       ID
--------- ------------------------- ------------------------- ----------
MESSAGE
-------------------------
28-NOV-01 localhost                 ORCL.WORLD                         4
Hello World Hello World

28-NOV-01 localhost                 ORCL.WORLD                         5
Hello World

28-NOV-01 localhost                 ORCL.WORLD                         6
Hello World Hello World


TIMESTAMP HOST                      APPLICATION                       ID
--------- ------------------------- ------------------------- ----------
MESSAGE
-------------------------
28-NOV-01 localhost                 ORCL.WORLD                         7
Hello World

28-NOV-01 localhost                 ORCL.WORLD                         8
Hello World Hello World

28-NOV-01 localhost                 ORCL.WORLD                         9
Hello World


TIMESTAMP HOST                      APPLICATION                       ID
--------- ------------------------- ------------------------- ----------
MESSAGE
-------------------------
28-NOV-01 localhost                 ORCL.WORLD                        10
Hello World Hello World


10 rows selected.

SQL> 

 

  • Java - Preparing JDBC:

The purpose of this JDBC Sample is to demonstrate how the Java Realtime Application:

  • Control requests from a Graphical User Interface.
  • Connect to a database (Using an Oracle JDBC driver).
  • Query the database.
  • Disconnect from the database.
  • Redirect the system message from the standard output.
  • Refresh system message on the Graphical User Interface periodically.

  • The following diagram shows:

    • how the interfaces communicate with each other through a common System Object.
    • how the SystemObject encapsulates the interfaces.

    --------------------------------------------------------------------------
    |                                                                        |
    |                                 SystemObject                           |
    |                                /     |      \                          |
    |                              /       |        \                        |
    |                            /         |          \                      |
    |                          /           |            \                    |
    | --------------------------  -------------------  --------------------- |
    | |                        |  |                 |  |                   | |
    | | GraphicalUserInterface |  | SystemInterface |  | DatabaseInterface | |
    | |                        |  |                 |  |                   | |
    | | - Handles database     |  | - Real-time     |  | - Connect         | |
    | | requests from user     |  | processing      |  | - Query           | |
    | |                        |  |                 |  |                   | |
    | |                        |  | e.g.            |  | - Disconnect      | |
    | |                        |  | Auto-refresh    |  |                   | |
    | |                        |  | on GUI messages |  |                   | |
    | |                        |  |                 |  |                   | |
    | --------------------------  -------------------  --------------------- |
    |                                                                        |
    --------------------------------------------------------------------------
    

 

  • Java - Create JDBC Sources:

  • Create "SystemObject.java" under the directory "c:\jdbc":
    import java.lang.*;
    
    import DatabaseInterface;
    import GraphicalUserInterface;
    import SystemInterface;
    
    public class SystemObject extends java.lang.Object
    {
      private DatabaseInterface      databaseInterface;
      private GraphicalUserInterface graphicalUserInterface;
      private SystemInterface        systemInterface;
    
      public SystemObject
      (
      )
      {
        super();
    
        this.setSystemInterface();
        this.setDatabaseInterface();
        this.setGraphicalUserInterface();
    
        return;
      }
    
      public static void main
      (
        java.lang.String argv[]
      )
      {
        SystemObject systemObject;
    
        systemObject = new SystemObject();
        systemObject.start();
    
        return;
      }
    
      public void start
      (
      )
      {
        this.getSystemInterface().start();
        this.getGraphicalUserInterface().start();
    
        return;
      }
    
      public void setSystemInterface
      (
      )
      {
        this.systemInterface = new SystemInterface(this);
    
        return;
      }
    
      public SystemInterface getSystemInterface
      (
      )
      {
        return this.systemInterface;
      }
    
      public void setDatabaseInterface
      (
      )
      {
        this.databaseInterface = new DatabaseInterface(this);
    
        return;
      }
    
      public DatabaseInterface getDatabaseInterface
      (
      )
      {
        return this.databaseInterface;
      }
    
      public void setGraphicalUserInterface
      (
      )
      {
        this.graphicalUserInterface = new GraphicalUserInterface(this);
    
        return;
      }
    
      public GraphicalUserInterface getGraphicalUserInterface
      (
      )
      {
        return this.graphicalUserInterface;
      }
    }
    
  • Create "SystemInterface.java" under the directory "c:\jdbc":
    import java.lang.*;
    import SystemObject;
    import java.io.*;
    
    public class SystemInterface extends java.lang.Thread
    {
      private static final int SLEEP_INTERVAL = 1000;
    
      private SystemObject                  systemObject;
      private boolean                       processFlag;
      private java.io.ByteArrayOutputStream byteArrayOutputStream;
    
      public SystemInterface
      (
        SystemObject systemObjectValue
      )
      {
        super();
    
        this.setProcessFlag(false);
        this.setSystemObject(systemObjectValue);
    
        this.setByteArrayOutputStream();
    
        java.lang.System.setOut
        (
          new java.io.PrintStream
          (
            (java.io.OutputStream)
            this.getByteArrayOutputStream(),
            true
          )
        );
    
        java.lang.System.setErr
        (
          new java.io.PrintStream
          (
            (java.io.OutputStream)
            this.getByteArrayOutputStream(),
            true
          )
        );
    
        return;
      }
    
      public void run
      (
      )
      {
        for (;;)
        {
          try
          {
            if (java.lang.Thread.currentThread() == this)
            {
              this.broadcast();
              if (this.getProcessFlag() == true)
              {
                this.startProcess();
    
                this.setProcessFlag(false);
    
                continue;
              }
    
              this.sleep(this.SLEEP_INTERVAL);
            }
          }
          catch
          (
            java.lang.Exception exceptionValue
          )
          {
            java.lang.System.err.println(exceptionValue.toString());
    
            break;
          }
    
          java.lang.Thread.yield();
        }
    
        return;
      }
    
      public void startProcess
      (
      )
      {
        if (this.getSystemObject().getDatabaseInterface().connect() == false)
        {
          return;
        }
    
        this.getSystemObject().getDatabaseInterface().query
        (
          "select log.* from scott.log"
        );
    
        this.getSystemObject().getDatabaseInterface().disconnect();
    
        return;
      }
    
      public void broadcast
      (
      )
      {
        this.getSystemObject().getGraphicalUserInterface().
          getOutputTextArea().setText
          (
            this.getSystemObject().getSystemInterface().
              getByteArrayOutputStream().toString()
          );
    
        this.getSystemObject().getGraphicalUserInterface().
          getOutputTextArea().select
          (
            this.getSystemObject().getGraphicalUserInterface().
              getOutputTextArea().getText().length(),
            this.getSystemObject().getGraphicalUserInterface().
              getOutputTextArea().getText().length()
          );
    
        return;
      }
    
      public void setSystemObject
      (
        SystemObject systemObjectValue
      )
      {
        this.systemObject = systemObjectValue;
    
        return;
      }
    
      public SystemObject getSystemObject
      (
      )
      {
        return this.systemObject;
      }
    
      public void setProcessFlag
      (
        boolean flagValue
      )
      {
        this.processFlag = flagValue;
    
        return;
      }
    
      public boolean getProcessFlag
      (
      )
      {
        return this.processFlag;
      }
    
      public void setByteArrayOutputStream
      (
      )
      {
        this.byteArrayOutputStream =
          new java.io.ByteArrayOutputStream();
    
        return;
      }
    
      public ByteArrayOutputStream getByteArrayOutputStream
      (
      )
      {
        return this.byteArrayOutputStream;
      }
    }
    
  • Create "GraphicalUserInterface.java" under the directory "c:\jdbc":
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.*;
    
    import SystemObject;
    
    public class GraphicalUserInterface extends java.awt.Frame
      implements java.awt.event.ItemListener,
                 java.awt.event.ActionListener
    {
      private static final int DIMENSION_WIDTH  = 640;
      private static final int DIMENSION_HEIGHT = 480;
      private static final int TEXTAREA_ROW     = 20;
      private static final int TEXTAREA_COLUMN  = 50;
    
      private SystemObject           systemObject;
      private java.awt.GridBagLayout gridBagLayout;
      private java.awt.Choice        inputChoice;
      private java.awt.Button        inputButton;
      private java.awt.TextArea      outputTextArea;
    
      public GraphicalUserInterface
      (
        SystemObject systemObjectValue
      )
      {
        super();
    
        this.setSystemObject(systemObjectValue);
        this.setGridBagLayout();
    
    // Event
        super.enableEvents(java.awt.AWTEvent.WINDOW_EVENT_MASK);
    
    // Size
        super.setSize
        (
          this.DIMENSION_WIDTH,
          this.DIMENSION_HEIGHT
        );
    
    // Title
        super.setTitle
        (
          this.getClass().getName()
        );
    
    // Layout
        super.setLayout(this.getGridBagLayout());
    
    // Components
        this.setInputChoice();
        this.setInputButton();
        this.setOutputTextArea();
    
        return;
      }
    
    /*
    // Events
    */
    
      protected void processWindowEvent
      (
        java.awt.event.WindowEvent windowEventValue
      )
      {
        super.processWindowEvent(windowEventValue);
        if (windowEventValue.getID() ==
            java.awt.event.WindowEvent.WINDOW_CLOSING)
        {
          super.setVisible(false);
          super.dispose();
          java.lang.System.exit(0);
        }
    
        return;
      }
    
      public void itemStateChanged
      (
        java.awt.event.ItemEvent itemEventValue
      )
      {
        java.awt.Choice choice;
    
        choice = (java.awt.Choice) itemEventValue.getItemSelectable();
        if (choice.getSelectedIndex() == 0)
        {
          return;
        }
    
        return;
      }
    
      public void actionPerformed
      (
        java.awt.event.ActionEvent actionEventValue
      )
      {
        if (this.getInputChoice().getSelectedIndex() == 0)
        {
          this.getSystemObject().getSystemInterface().setProcessFlag(true);
    
          return;
        }
    
        return;
      }
    
    /*
    // Methods
    */
    
      public void addComponent
      (
        java.awt.Component componentValue,
        int                rowValue,
        int                columnValue,
        int                widthValue,
        int                heightValue,
        int                weightxValue,  // can grow wider
        int                weightyValue,  // can grow taller
        int                fillValue
      )
      {
        java.awt.GridBagConstraints gridBagConstraints =
          new java.awt.GridBagConstraints();
    
        gridBagConstraints.gridx      = columnValue;
        gridBagConstraints.gridy      = rowValue;
    
        gridBagConstraints.gridwidth  = widthValue;
        gridBagConstraints.gridheight = heightValue;
    
        gridBagConstraints.weightx    = weightxValue;
        gridBagConstraints.weighty    = weightyValue;
    
        gridBagConstraints.fill       = fillValue;
    
        this.gridBagLayout.setConstraints
        (
          componentValue,
          gridBagConstraints
        );
        super.add(componentValue);
    
        return;
      }
    
      public void start
      (
      )
      {
        super.setVisible(true);
      }
    
      public void setSystemObject
      (
        SystemObject systemObjectValue
      )
      {
        this.systemObject = systemObjectValue;
    
        return;
      }
    
    /*
    // Attribute Methods
    */
    
      public SystemObject getSystemObject
      (
      )
      {
        return this.systemObject;
      }
    
      public void setGridBagLayout
      (
      )
      {
        this.gridBagLayout = new java.awt.GridBagLayout();
    
        return;
      }
    
      public java.awt.GridBagLayout getGridBagLayout
      (
      )
      {
        return this.gridBagLayout;
      }
    
      public void setOutputTextArea
      (
      )
      {
        this.outputTextArea = new java.awt.TextArea();
        this.outputTextArea.setRows(this.TEXTAREA_ROW);
        this.outputTextArea.setColumns(this.TEXTAREA_COLUMN);
        this.outputTextArea.setEditable(false);
        this.outputTextArea.setEnabled(true);
        this.outputTextArea.setText(null);
        this.outputTextArea.setVisible(true);
        this.addComponent(this.outputTextArea, 2, 1,
                           1, 1, 0, 0, java.awt.GridBagConstraints.NONE);
    
        return;
      }
    
      public java.awt.TextArea getOutputTextArea
      (
      )
      {
        return this.outputTextArea;
      }
    
      public void setInputChoice
      (
      )
      {
        this.inputChoice = new java.awt.Choice();
    
        this.inputChoice.addItemListener(this);
        this.inputChoice.add("Oracle");
        this.addComponent(this.inputChoice, 1, 1,
                           1, 1, 0, 0,
                           java.awt.GridBagConstraints.HORIZONTAL);
    
        return;
      }
    
      public java.awt.Choice getInputChoice
      (
      )
      {
        return this.inputChoice;
      }
    
      public void setInputButton
      (
      )
      {
        this.inputButton = new java.awt.Button();
        this.inputButton.addActionListener(this);
        this.inputButton.setLabel("OK");
        this.inputButton.setVisible(true);
        this.addComponent(this.inputButton, 1, 2,
                           1, 1, 0, 0, java.awt.GridBagConstraints.NONE);
    
        return;
      }
    
      public java.awt.Button getInputButton
      (
      )
      {
        return this.inputButton;
      }
    }
    
  • Create "DatabaseInterface.java" under the directory "c:\jdbc":
    import java.lang.*;
    import java.sql.*;
    import java.io.*;
    
    import SystemObject;
    
    public class DatabaseInterface extends java.lang.Object
    {
      private SystemObject                  systemObject;
      private java.sql.Connection           connection;
      private java.sql.Statement            statement;
      private java.sql.ResultSet            resultSet;
    
      public DatabaseInterface
      (
        SystemObject systemObjectValue
      )
      {
        super();
    
        this.setSystemObject(systemObjectValue);
    
        return;
      }
    
    /*
    // Methods
    */
    
      public boolean connect
      (
      )
      {
        boolean flag;
    
        flag = true;
    
        try
        {
          java.sql.DriverManager.registerDriver
          (
            new oracle.jdbc.driver.OracleDriver()
          );
    
          this.setConnection
          (
            java.sql.DriverManager.getConnection
            (
              "jdbc:oracle:oci8:@orcl.world",
              "scott",
              "tiger"
            )
          );
    
          java.sql.DriverManager.setLogWriter
          (
            new java.io.PrintWriter(java.lang.System.out, true)
          );
        }
        catch
        (
          java.lang.Exception exceptionValue
        )
        {
          java.lang.System.err.println(exceptionValue.toString());
    
          flag = false;
        }
    
        return flag;
      }
    
      public void query
      (
        java.lang.String queryValue
      )
      {
        int index;
    
        try
        {
          this.setStatement
          (
            this.getConnection().createStatement()
          );
    
          this.setResultSet
          (
            this.getStatement().executeQuery
            (
              queryValue
            )
          );
    
          while (this.getResultSet().next() == true)
          {
            index = 1;
            while (index <= this.getResultSet().getMetaData().getColumnCount())
            {
              java.lang.System.out.println(this.getResultSet().getString(index));
    
              index++;
            }
          }
    
          this.getResultSet().close();
        }
        catch
        (
          java.lang.Exception exceptionValue
        )
        {
          java.lang.System.err.println(exceptionValue.toString());
    
          return;
        }
    
        return;
      }
    
      public void disconnect
      (
      )
      {
        try
        {
          this.getConnection().close();
        }
        catch
        (
          java.lang.Exception exceptionValue
        )
        {
          java.lang.System.err.println(exceptionValue.toString());
    
          return;
        }
    
        return;
      }
    
    /*
    // Attribute Method
    */
    
      public void setSystemObject
      (
        SystemObject systemObjectValue
      )
      {
        this.systemObject = systemObjectValue;
    
        return;
      }
    
      public SystemObject getSystemObject
      (
      )
      {
        return this.systemObject;
      }
    
      public void setConnection
      (
        java.sql.Connection connectionValue
      )
      {
        this.connection = connectionValue;
    
        return;
      }
    
      public java.sql.Connection getConnection
      (
      )
      {
        return this.connection;
      }
    
      public void setStatement
      (
        java.sql.Statement statementValue
      )
      {
        this.statement = statementValue;
    
        return;
      }
    
      public java.sql.Statement getStatement
      (
      )
      {
        return this.statement;
      }
    
      public void setResultSet
      (
        java.sql.ResultSet resultSetValue
      )
      {
        this.resultSet = resultSetValue;
    
        return;
      }
    
      public java.sql.ResultSet getResultSet
      (
      )
      {
        return this.resultSet;
      }
    }
    

 

  • Java - Testing JDBC:

Make sure that the Oracle server has already started and the PL/SQL sample scripts were executed.

  • Under MS-DOS, start the Listener from Oracle.
    E:\Oracle\Ora81\BIN\lsnrctl.exe
    start
    
  • Compile the JDBC sources under the directory "c:\jdbc":
    del *.class
    d:\progra~1\jdk1.3.1_01\bin\javac.exe -classpath ".;E:\Oracle\Ora81\jdbc\lib\classes12.zip" *.java
    
    The Oracle JDBC driver is included in "classes12.zip".
  • Execute the JDBC Application:
    d:\progra~1\jdk1.3.1_01\bin\java.exe -classpath ".;E:\Oracle\Ora81\jdbc\lib\classes12.zip" SystemObject
    
    The Oracle JDBC driver is included in "classes12.zip".

 

  • Developer - Preparation:

NOTE: The following Developer setup deals with the Window Registry file. So it may damage the Windows 98 Operating System if the settings are incorrect.

  • Under MS-DOS, export the registry file before installing Developer 6.
    c:\windows\regedit.exe
    Registry -> Export Registry File -> c:\developer\pre-developer.reg
    

 

  • Developer - First Installation:

  • Run "setup.exe" from installation media.
  • Language: English
  • Oracle Installation Settings:
    Company Name: _
    Oracle Home: d:\progra~1\orawin95
    
  • Home Change Information:

    This will be prompted since the Oracle Home from the Oracle 8i installation "e:\oracle\ora81" is different to the Developer's Oracle Home "d:\progra~1\orawin95".

  • Modification Path: No
  • Oracle Developer Installation Options: Development Installation -> Cancel
  • Software Asset Manager: Highlight all the available products and hit "Install"
  • System Support Files: OK
  • Error Information:

    "GUI60.vrf(56): FILE_NOT_FOUND while translating NLS_LANG from $oracle" OK and Exit.

    This error message should not appear in the next installation attempt. The second installation attempt on Developer 6 should treat "d:\progra~1\orawin95" as the new Oracle Home by default rather than "e:\oracle\ora81".

 

  • Developer - Second Installation:

  • Repeat the steps of the First Installation. The error information prompt should not appear in the Second Installation.
  • When it prompts for "Directory Selection" just click OK. e.g.
    Where should Oracle Developer - Forms be installed?
    d:\progra~1\orawin95\FORMS60
    
  • INTERSOLV DataDirect Driver Selection: None
  • When installation is completed, it will prompt the user.
  • Under MS-DOS, export the registry file after installing Developer 6.
    c:\windows\regedit.exe
    Registry -> Export Registry File -> c:\developer\post-developer.reg
    

 

  • Developer - Testing:

  • Start Database:
    Start -> Programs -> Oracle - OraHome81
    -> Database Administration -> Start Database
    
  • The following error may be prompted: OSTART
    Cannot open registry
    \SID_LIST
    Starting with default sid
    
  • The following error may be prompted: Oracle8i Startup
    ORA-12538
    Cannot attach to Oracle8i
    
  • Under MS-DOS, import the registry file for Developer pre-install.
    c:\windows\regedit.exe
    Registry -> Import Registry File -> c:\developer\pre-developer.reg
    
    This should write the Oracle Home information back to the windows registry.
  • Under MS-DOS, import the registry file for Developer post-install.
    c:\windows\regedit.exe
    Registry -> Import Registry File -> c:\developer\post-developer.reg
    
    This should write the necessary information for Developer back to the windows registry.
  • Backup "d:\progra~1\orawin95\net80\admin\tnsnames.ora" to "d:\progra~1\orawin95\net80\admin\tnsnames.ora.old"
  • Edit "d:\progra~1\orawin95\net80\admin\tnsnames.ora"
    orcl.world =
      (DESCRIPTION =
        (ADDRESS_LIST =
            (ADDRESS =
              (PROTOCOL = TCP)
              (Host = 127.0.0.1)
              (Port = 1521)
            )
        )
        (CONNECT_DATA = (SID = ORCL)
        )
      )
    
  • Start Database
    Start -> Programs -> Oracle - OraHome81
    -> Database Administration -> Start Database
    
  • Under MS-DOS, start Listener by:
    E:\Oracle\Ora81\BIN\lsnrctl.exe
    start
    
  • Under MS-DOS, test the connection between Developer and the Oracle Database.
    d:\progra~1\orawin95\bin\tnsping80.exe orcl.world
    

 

  • Developer - Form Builder:

  • To start "Form Builder", click on "Start" on the desktop:
    Start -> Programs -> Oracle Developer 6.0 -> Form Builder
    
  • Use the Data Block Wizard
    Table or View: log
    User Name: scott
    Password: tiger
    Database: orcl.world
    Click on the ">>" button then click Next.
    
    Create data block, then call the Layout Wizard
  • Layout Wizard
    Canvas: (New Canvas)
    Type: Content
    Displayed Item: Click on the ">>" button then click Next
    Layout Style: Select Form
    Frame Title: Log Insert
    
  • Object Navigator (Tools -> Object Navigator)
  • Increase the frame border
    Layout Editor (Tools -> Layout Editor)
    Selecting the frame border where the "Log Insert" label
    sits then click and drag its point to increase its size.
    
  • Adding an OK Button
    Layout Editor (Tools -> Layout Editor)
    
    - Select the "Button" icon on the left of the Layout Editor.
    - Click it within the frame border and a button will appear.
    - Double click on the button and a "Property Palette" window will appear
    - On the Property Palette, go to Functional -> Label and change it
    to "Insert".
    - With the button still selected, use the right mouse button to click
    on the button and select "PL/SQL Editor".
    - Select "WHEN-BUTTON-PRESSED" for its Trigger.
    - In the "PL/SQL Editor" enter the following and then click
    on the "Compile" button.
    
    begin
      insert into log(timestamp, host, application, id, message)
      values(:timestamp, :host, :application, :id, :message);
    end;
    
    
  • Test Run (Program -> Run Form -> Client/Server)

    Fill in the fields of the form. e.g.

    Timestamp: 01-jan-2001
    Host: localhost
    Application: log_insert_form
    Id: 1
    Message: testing
    
    Click on the "Insert" button and should prompt "Do you want to save the changes you have made?" Click "Yes" so the transaction will be commited to the database.
  • On SQL*Plus, enter the following query.
    select * from log;
    
    The new entry should be listed.
  • Save the Form, select the Form Builder window:
    File -> Save As -> c:\developer\log_insert_form.fmb
    

 

  • Developer - Form Compiler:

  • Open "Form Compiler" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Form Compiler
    File: c:\developer\log_insert_form.fmb
    
    Userid: scott
    Password: tiger
    Database: orcl.world
    

 

  • Developer - Form Runtime:

  • Open "Form Runtime" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Form Runtime
    File: c:\developer\log_insert_form.fmx
    
    Username: scott
    Password: tiger
    Database: orcl.world
    

 

  • Developer - Graphics Builder:

  • Open "Graphics Builder" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Graphics Builder
    
  • "Layout Editor" window:
    Click on the "Chart icon" on the left of the Layout Editor Window.
    Click and drag on the window.
    
    A "Chart Genie" window should appear.
  • "Chart Genie" window:
    Name: query0
    Type: SQL Statement
    SQL Statement: select log.* from scott.log;
    
    Click on Execute.
    
    User Name: scott
    Password: tiger
    Database: orcl.world
    
  • Chart Properties:
    Name: log_data
    Title: Log Data
    Click OK
    
    Click on the chart to return to the Chart Properties and try changing the chart categories to show charts of different fields e.g. TIMESTAMP, MESSAGE, etc.
  • Save the Graph:
    File -> Save As -> File System -> c:\developer\log_graph.ogd
    

 

  • Developer - Report Builder:

  • Open "Report Bulider" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Report Builder
    
  • "Build a new report manually"
    File -> New -> Report
    
  • To launch "Report Editor" on the Object Navigator:
    Click on Reports -> "UNTITLED" -> Double-click on the "Data Model" icon
    
  • On the Report Editor:
    Click on the SQL Query icon on the left of the Report Editor Window
    Click and drag a box on the Report Editor.
    
    SQL Query Statement: select log.* from scott.log;
    
    User Name: scott
    Password: tiger
    Database: orcl.world
    
  • Test Run:
    Click on the "Run" icon at the top of the Report Editor window:
    
    "You cannot run without a layout. Would you like to create a default layout?"
    Click "Yes"
    
    Report Wizard:
    
    Style Tab -> Tabular -> Title: Log Report
    Fields Tab -> Click on the ">>" button.
    Hit "Finish".
    
  • Save the Report.
    File -> Save As -> c:\developer\log_report.rdf
    

 

  • Developer - Report Compiler:

  • Open "Report Compiler" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Report Compiler
    
    Convert
    
    Document Type: Report
    Source Type: Report Binary File (RDF)
    Source: c:\developer\log_report.rdf
    Destination Type: Report Binary Run-only File (REP)
    Destination: c:\developer\log_report.rep
    

 

  • Developer - Report Runtime:

  • Open "Report Runtime" by clicking on the Start button on the desktop.
    Start -> Programs -> Oracle Developer 6.0 -> Reports Runtime
    File -> Run -> c:\developer\log_report.rep
    
    User Name: scott
    Password: tiger
    Database: orcl.world
    




 

  • Error Symptoms:

  • Problem: JDBC
    java.sql.SQLException: ORA-12154: TNS:could not resolve service name
    
    Possible Solution: This may happen when a Java client requests a database connection but the database server has not started or not listening. 1. Make sure the service name in the host string is correct. e.g.
    "jdbc:oracle:oci8:@orcl.world"
    
    2. Start the Oracle Server 3. Start the Listener. Under MS-DOS:
    lsnrctl.exe
    start
    
  • Problem: JDBC
    java.sql.SQLException: ORA-12541: TNS:no listener
    
    Possible Solution: This may happen when a Java client requests a database connection but the database server has not started or not listening. 1. Make sure the service name in the host string is correct. e.g.
    "jdbc:oracle:oci8:@orcl.world"
    
    2. Start the Oracle Server 3. Start the Listener. Under MS-DOS:
    lsnrctl.exe
    start
    
  • Problem: PL/SQL
    Warning: Function created with compilation errors.
    
    Possible Solution: Execute the following query to trace the problem.
    select * from user_errors;
    
  • Problem:
    Java client not showing changes made in SQL*Plus.

    Possible Solution:
    Exit SQL*Plus and request from the Java client again.

  • Problem: Developer
    ORA-12203: TNS:unable to connect to destination
    

    Possible Solution:

    The database server has not started yet. Start the Database Server
    and the Listener before the next connection.
    


 

Primac Systems Limited

Copyright 2001

 

Hosted by www.Geocities.ws

1