Oracle8i SQLJ Developer's Guide and Reference Release 3 (8.1.7) Part Number A83723-01 |
Library | Service | Contents | Index

## Server-Side Sample

This section contains a sample that runs in the server. This demo is located in the following directory:

    [Oracle Home]/sqlj/demo/server

For a full discussion of SQLJ in the server, see Chapter 11, "SQLJ in the Server".

### SQLJ in the Server--ServerDemo.sqlj

This example demonstrates a SQLJ application that runs in the JServer embedded Java virtual machine of the Oracle8i server.

Before trying to run this server-side demo application, refer to `README.txt` in the following directory:

    [Oracle Home]/sqlj/demo/server

    //---------------- Start of file ServerDemo.sqlj ----------------

    import java.sql.Date;
    import java.sql.SQLException;

    class ServerDemo
    {
      public static void main (String argv[])
      {
        // Note: No explicit connection setup is required
        //       for server-side execution of SQLJ programs.

        try {
          System.out.println("Hello! I'm SQLJ in server!");

          Date  today;
          #sql {select sysdate into :today from dual};
          System.out.println("Today is " + today);

          System.out.println("End of SQLJ demo.");
       } catch (SQLException e) {
             System.out.println("Error running main: " + e);
         }
      }
    }

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index