Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle Java thin client: security.Couldn't connect

Oracle Java thin client: security.Couldn't connect

From: Daniel Askey <daniel_at_www.ecsinc.net>
Date: 1998/01/14
Message-ID: <34BD2AFF.72899DD0@www.ecsinc.net>#1/1

Hi,
I'm trying to get around some Java Applet security restrictions. I have enabled the "UniversalConnect" privilege with these results: 1)Netscape 3.0 - connection is made
2)Netscape 4.03/4.04 - errors below
security.Couldn't connect to '<remote-address>' with origin from '<local-address>'.
local-address is something like "local-class-path" 3)Applet Viewer - connection is made
?
Any ideas why it won't work with 4.03/4.04?

Thanks,
Daniel

//--Start code--

/*

// Import the JDBC classes

import java.sql.*;
//import netscape.security.PrivilegeManager.*;

// Import the java classes used in applets

import java.awt.*;
import java.io.*;
import java.util.*;

public class jdbc2 extends java.applet.Applet {
  // The driver to load
  static final String driver_class = "oracle.jdbc.driver.OracleDriver";

  // The connect string
  static final String connect_string =

"jdbc:oracle:thin:<id/password_at_url_address>:port:database_name";

  // The query we will execute
  static final String query = "select 'Hello JDBC: ' || sysdate from dual";

  // The button to push for executing the query   Button execute_button;

  // The place where to dump the query result   TextArea output;

  // The connection to the database
  Connection conn;

  // Create the User Interface
  public void init ()
  {
   System.out.println("Hey I am in the init function\n");     try {
    netscape.security.PrivilegeManager.enablePrivilege( "UniversalConnect");

       } catch (netscape.security.ForbiddenTargetException e) {  // Failed because the privilege is forbidden

           String property = "user.home";
           try {
             String propertyValue = System.getProperty(property);
           } catch (netscape.security.AppletSecurityException f) {
             // Failed because the privilege has not been enabled
  System.out.println("Well Security not granted");
           }
         }

    this.setLayout (new BorderLayout ());     Panel p = new Panel ();
    p.setLayout (new FlowLayout (FlowLayout.LEFT));     execute_button = new Button ("Hello JDBC");     p.add (execute_button);
    this.add ("North", p);
    output = new TextArea (10, 60);
    this.add ("Center", output);
  }

  // Do the work
  public boolean action (Event ev, Object arg)   {
    if (ev.target == execute_button)
    {

      try
      {

 // Clear the output area
 output.setText (null);

 // See if we need to open the connection to the database  if (conn == null)
 {
   // Load the JDBC driver
   output.appendText ("Loading JDBC driver " + driver_class + "\n");    Class.forName (driver_class);

   // Connect to the databse
   output.appendText ("Connecting to " + connect_string + "\n");    conn = DriverManager.getConnection (connect_string);
//CONNECTION ERROR RESULTS FROM LINE ABOVE
   output.appendText ("Connected\n");
 }

 // Create a statement
 Statement stmt = conn.createStatement ();

 // Execute the query
 output.appendText ("Executing query " + query + "\n");  ResultSet rset = stmt.executeQuery (query);

 // Dump the result
 while (rset.next ())
   output.appendText (rset.getString (1) + "\n");

 // We're done
 output.appendText ("done.\n");

      }
      catch (Exception e)
      {

 // Oops
 output.appendText (e.getMessage () + "\n");
      }
      return true;

    }
    else
      return false;
  }
} Received on Wed Jan 14 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US