Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Post by Juhani Jaakol » Wed, 12 Aug 1998 04:00:00



I downloaded last Friday the newest JDBC Thin drivers for UNIX from
www.oracle.com. I tested the sample applet from
thin-1.0.2/JdbcApplet.java. I compiled it with JDK 1.2 Beta 2 on NT 4.0
SP 3 and transferred the binary .class file to UNIX WWW Server.

With Netscape 3.0 Gold the applet works fine. Java Console shows
however:

  AppAccelerator(tm) 1.0.2 for Java, x86 version.
  Copyright (c) 1996 Borland International. All Rights Reserved.
  # Security Exception: properties

With Microsoft Internet Explorer 3 the applet doesn't do anything. I
can't get any error messages out of it, it just doesn't run.

With Microsoft Internet Explorer 4 (Microsoft (R) VM for Java (tm), 4.0
Release 4.79.0.2339) I get the following error message in the Java
console:

com.ms.security.SecurityExceptionEx[jdbc/sql/DriverManager.loadInitialDrivers]:
Unable to access system property: jdbc.drivers
        at com/ms/security/permissions/PropertyPermission.check
        at com/ms/security/PolicyEngine.shallowCheck
        at com/ms/security/PolicyEngine.checkCaller*ission
        at com/ms/security/StandardSecurityManager.chk
        at com/ms/security/StandardSecurityManager.checkPropertyAccess
        at java/lang/System.getProperty
        at jdbc/sql/DriverManager.loadInitialDrivers
        at jdbc/sql/DriverManager.initialize
        at jdbc/sql/DriverManager.getConnection
        at jdbc/sql/DriverManager.getConnection
        at JdbcApplet.action
        at java/awt/Component.handleEvent
        at java/awt/Component.postEvent
        at java/awt/Component.postEvent
        at java/awt/Component.postEvent
        at java/awt/Component.dispatchEventImpl
        at java/awt/Component.dispatchEvent
        at java/awt/WUIPeer.handleEvent
        at java/awt/WButtonPeer.handleEvent
        at java/awt/Component.postEvent
        at com/ms/ui/AwtUIHost.postEvent
        at java/awt/WUIPeer.postEvent
        at com/ms/ui/UIRoot.postEvent
        at com/ms/ui/UIComponent.postEvent
        at com/ms/ui/UIStateContainer.postEvent
        at com/ms/ui/UIButton.
        at com/ms/ui/UIButton.mouseClicked
        at com/ms/ui/UIComponent.handleEvent
        at com/ms/ui/UIComponent.postEvent
        at com/ms/ui/UIStateContainer.postEvent
        at com/ms/ui/UIComponent.postEvent
        at com/ms/ui/UIStateComponent.postEvent
        at com/ms/ui/UIRoot.?
        at com/ms/ui/UIRoot.forwardEvent
        at com/ms/ui/AwtUIHost.postEvent
        at java/awt/WUIPeer.postEvent
        at com/ms/ui/AwtUIHost.processEvent
        at java/awt/Component.dispatchEventImpl
        at java/awt/Container.dispatchEventImpl
        at java/awt/Component.dispatchEvent
        at java/awt/EventDispatchThread.run

Apparently Oracle's JDBC driver tries to access system property
jdbc.drivers and MS IE's security manager thinks that's a bad thing. Is
there a workaround?

We have 100 users using MS IE version 3, is it possible to use JDBC Thin
with it?

 
 
 

Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Post by Carlo Emanuele Demonti » Wed, 19 Aug 1998 04:00:00


I had the same problem using IE and netscape.
My collegues and I solved it this way:

in the declaring section write this line

 oracle.jdbc.driver.OracleDriver dr = new oracle.jdbc.driver.OracleDriver();

it will force the browser to load and instanciate the class
oracle.jdbc.driver.OracleDriver

then DO NOT specify the driver's name in the db/connection constructor.
if you specify it the browser will try to read and then rewrite the system's
properties and you get the security violation.
if you write that line and don't specify the driver as a string it wont raise the
exception.

if you wand I can email you a sniplet of the code w are developing.
we are using Borland's JBuilder

Carlo


Quote:> Hi I have the same problem. Signing the Applet solves the security problem
> but know I get the error "No suitable Driver" but the applet loaded the
> correct "oracle.jdbc.driver.OracleDriver".

> I am pleased with any help.

> Vera


 
 
 

Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Post by Carlo Emanuele Demonti » Wed, 19 Aug 1998 04:00:00


I had the same problem using IE and netscape.
My collegues and I solved it this way:

in the declaring section write this line

 oracle.jdbc.driver.OracleDriver dr = new oracle.jdbc.driver.OracleDriver();

it will force the browser to load and instanciate the class
oracle.jdbc.driver.OracleDriver

then DO NOT specify the driver's name in the db/connection constructor.
if you specify it the browser will try to read and then rewrite the system's
properties and you get the security violation.
if you write that line and don't specify the driver as a string it wont raise the
exception.

if you wand I can email you a sniplet of the code w are developing.
we are using Borland's JBuilder

Carlo


Quote:> Hi I have the same problem. Signing the Applet solves the security problem
> but know I get the error "No suitable Driver" but the applet loaded the
> correct "oracle.jdbc.driver.OracleDriver".

> I am pleased with any help.

> Vera

 
 
 

Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Post by Michael Boehme » Fri, 04 Sep 1998 04:00:00


The work around is creating a new instance:

    Class.forName(driverName).newInstance();

This works fine for IE 4.0.

I've found this trick in an artikel of the newsgroup

Michael Boehmer


> [...] But soon you want to use them to connect
> a databse you get the error "No suitable driver".

> If I install the drivers local on the client and set the classpath it works.
> But that is not the way it should work.

> Any other work around?

 
 
 

Oracle JDBC Thin Applet + MS IE: SecurityException accessing jdbc.drivers system property

Post by Juhani Jaakol » Mon, 28 Sep 1998 04:00:00


I finally found a working work-around to this problem!

The problem was that Oracle's JDBC sample program would run on Netscape
3 but not on MS IE 3. With MS IE the applet crashes when it tries to
acceess system property jdbc.drivers. Apparently MS IE generates an
incorrect exception which is not caught by the JDBC DriverManager.

I found info about this in a FAQ on http://www.connectsw.com/ Basically
you have to instantiate the driver twice. The first time dies, but it
somehow succeeds on the second time. Don't ask me why this works!

Below is a diff of my changes to the JDBC 7.3.4 JdbcApplet.java (the
thin-1.0.2 version):

hanselr:root >diff JdbcApplet.java.org JdbcApplet.java
10a11

Quote:> import oracle.jdbc.dnlddriver.*;  // is this really needed?

67c69,71
<         Class.forName (driver_class);
---
Quote:> oracle.jdbc.dnlddriver.OracleDriver d0 = new oracle.jdbc.dnlddriver.OracleDriver();
> oracle.jdbc.dnlddriver.OracleDriver d = new oracle.jdbc.dnlddriver.OracleDriver();