File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes access control exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "access control exception" Watch "access control exception" New topic
Author

access control exception

satish
Greenhorn

Joined: Jul 03, 2000
Posts: 27
I am new to jdbc. I got the following error while i was trying to load driver from an applet. I understand that browsers have some security restrictions for accessing the files. Can any one tell me how to get around this problem ?
(my html doc and database are on the local machine)
java.security.AccessControlException:
access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)

satish
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Welcome to the wonderful workd of java/jdbc...
Please checkout the COBOl-DB2-SQL post. I have a java/jdbc
application example. Change the drivers and the sql...
It should work as is....
Try the following:
1. re-write you applet as an application. to test all of your platform security and access path issues ie.(classpath).
2. if #1 works. run your html & applet with appletviewer. To
make sure you have code your html correctly.
Hope this helps....
monty6
satish
Greenhorn

Joined: Jul 03, 2000
Posts: 27
I've gone through the netscape preferences to see if can lower the security guard. I could not find anything related.
All of a sudden my applet started working fine in the browser. I didn't change any code. However if i run the same applet using applet viewer, i still get the access control exception
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
what ver of the jdk are you using?
what ver of the netscape browser are you using?
are you using any ide's?
what is you classpath?
the reason why i ask these questions is.
1. your browser my not be supporting the ver of the jdk you are compiling in.
2. some ide's provide vendor supplied routines that are not always 100% pure java.
3. check you class path to make shre it is correct. if you are using any jar files you must spell out the entire name (xxx.jar)
i off for the weekend.
going to the beach.
i will look for you on monday morning est
monty6
satish
Greenhorn

Joined: Jul 03, 2000
Posts: 27
Monty,
Hope you had a nice time at the beach.
I am using JDK1.3 and Netscape 4.73. I am not using any IDEs.
I checked again. My applet works perfectly alright within the browser but while running it using applet viewer throws access control exception.
I read somewhere that appletviewer assumes all applets are trusted ones and hence it does not check for security. In my case, the opposite is happening. As you said this may because my browser doesn't support JDK1.3 related JVM.
I haven't used any jar files. i don't see any problem with class path.
Regards,
Satish
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
please post code or email me a copy mireland1@mediaone.net
i have netscape 4.6 and explorer 5.0...
if you do not mind i would like to run your code to see if i get
the same problem.
I stumped....
monty6
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Oracle8i Complete Reference pg 687 chapt 33.
Be sure to use a version of the JDK that is compatible with the ORACLE release you are using. If you use a new release of the JDK with an older release of Oracle's drivers, you may (in this case you have) encounter "access violations" errors when execution you programs.
Note:
Your ver of Netscape is an older version with support for an older version of the jdk. Basic java/jdbc/oracle should work.
I am glad this problem is finally resolved. For I will be crossing the same bridge in a few days.
Enjoy the day, Monty6
[This message has been edited by monty6 (edited August 07, 2000).]
satish
Greenhorn

Joined: Jul 03, 2000
Posts: 27
Monty, I mailed my java files to you. Thanks for helping me
vijay anandn
Greenhorn

Joined: Sep 27, 2001
Posts: 1
Originally posted by sat:
I am new to jdbc. I got the following error while i was trying to load driver from an applet. I understand that browsers have some security restrictions for accessing the files. Can any one tell me how to get around this problem ?
(my html doc and database are on the local machine)
java.security.AccessControlException:
access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: access control exception