CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Security Exceptions

    Hello,

    I recently made a java application which goes into a database using jdbc.odbc.JdbcOdbcDriver. When I converted the app. into an applet I got the following error


    Starting!!!
    java.security.AccessControlException: access denied (java.lang.RuntimePermission
    accessClassInPackage.sun.jdbc.odbc )
    at java.security.AccessControlContext.checkPermission(Compiled Code)
    at java.security.AccessController.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkPackageAccess(Compiled Code)
    at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:172)

    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:237)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Compiled Code)
    at DisplayAlarms01.connectDb(DisplayAlarms01.java:69)
    at DisplayAlarms01.start(DisplayAlarms01.java:45)
    at sun.applet.AppletPanel.run(Compiled Code)
    at java.lang.Thread.run(Thread.java:479)

    As far as I can tell the applet does not have permission to access the database object...If this is so how can I grant access to the applet to do this.

    If not...then any help would be appreciated

    Thanks Joe

    P.S.

    It would be great if you replied to [email protected] instead of the board. I just check my email more often.


  2. #2
    Join Date
    Dec 1999
    Location
    Chonghe, Taipei County, Taiwan, R.O.C.
    Posts
    231

    Re: Security Exceptions

    If you use jdbc.odbc.JdbcOdbcDriver in your applet to access the database, it might
    be the problem. you may query some JDBC drivers which are implemented in Java.
    If the JDBC driver is type 3 or 4, it might be used in the applet for accessing database
    in the backend. Otherwise, you may relay your access request and access result in
    the middle tier through servlet or other methods.
    good luck


  3. #3
    Join Date
    Sep 1999
    Location
    Dubai, UAE
    Posts
    38

    Re: Security Exceptions

    Hi,

    Re. JdbcOdbcDriver, it won't work from inside an applet. Reason - ODBC access - somewhere up the hierarchy - will need access to a DLL. Applets are not allowed to load / work with native code - so DLL access will be disabled. Pure Java implementations of the drivers - on the other hand ( also called Thin drivers ) - use network connections to the database hosts - so will work from inside the browser, again, if the browser u tried it from was IE, u can try Microsoft's JdbcOdbc Driver - which will allow the connection ( the driver's name is com.ms.jdbc.odbc.JdbcOdbcDriver ) - with Netscape - the driver HAS to be pure Java.

    One more aspect for concern will be that an applet will be allowed to connect ( through a network connection ) - only to the host from where it came - meaning - if ur applet and it's container page are located on a different machine from the server that served ur pages, even a pure Java driver might not help.

    Hope that was helpful.

    Rgds,

    R.Saravanan


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured