Topic: 求助:(applet/jdbc:odbc - AccessControlException: access denied) |
Print this page |
1.求助:(applet/jdbc:odbc - AccessControlException: access denied) | Copy to clipboard |
Posted by: blackhorse_zou Posted on: 2005-10-11 14:06 请尽量使用准确的文字描述作为标题 Original subject : 求助: 各位大虾,帮帮忙 我的部分代码如下:(数据库为:SQL) String connectionURL="jdbc:odbc:sde"; String name,zchar,tchar,mdchar,charxyd,char01,char02; int objid,id,shape; float x,y; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); Connection con=DriverManager.getConnection(connectionURL); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from 油井"); java控制台的提示信息为: ---------------------------------------------------- java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPackageAccess(Unknown Source) at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at MyInquireApplet.actionPerformed(MyInquireApplet.java:54) at java.awt.Button.processActionEvent(Unknown Source) at java.awt.Button.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 请问这是什么问题?(我是刚接触java的新手,我做的是一个applet,编译通过了,但是执行的时候没有任何反应,就是控制台出现这样的提示!) |
2.Re:求助: [Re: blackhorse_zou] | Copy to clipboard |
Posted by: dalor_cheng Posted on: 2005-10-11 18:51 我是一个JAVA初学者,我对它很感兴趣,在书中,我看得懂那些程序,但让我自已编就只能会一些简单的东西,怎样才能提高理解能力,使自己有能力编程呢? EMAIL:dalor_cheng@yahoo.com |
3.Re:求助: [Re: blackhorse_zou] | Copy to clipboard |
Posted by: q_yuan Posted on: 2005-10-11 20:26 你是否正确设置好了ODBC数据源?或者是数据库有密码! |
4.Re:求助:(applet/jdbc:odbc - AccessControlException: access denied) [Re: blackhorse_zou] | Copy to clipboard |
Posted by: why Posted on: 2005-10-11 20:37 http://java.sun.com/products/jdbc/faq.html#3 3. Can the JDBC-ODBC Bridge be used with applets? Use of the JDBC-ODBC bridge from an untrusted applet running in a browser, such as Netscape Navigator, isn't allowed. The JDBC-ODBC bridge doesn't allow untrusted code to call it for security reasons. This is good because it means that an untrusted applet that is downloaded by the browser can't circumvent Java security by calling ODBC. Remember that ODBC is native code, so once ODBC is called the Java programming language can't guarantee that a security violation won't occur. On the other hand, Pure Java JDBC drivers work well with applets. They are fully downloadable and do not require any client-side configuration. Finally, we would like to note that it is possible to use the JDBC-ODBC bridge with applets that will be run in appletviewer since appletviewer assumes that applets are trusted. In general, it is dangerous to turn applet security off, but it may be appropriate in certain controlled situations, such as for applets that will only be used in a secure intranet environment. Remember to exercise caution if you choose this option, and use an all-Java JDBC driver whenever possible to avoid security problems. For more information, search on Google, or read the following tutorial: http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/dba.html#odbc Database Access by Applets - JDBC-ODBC Bridge with ODBC Driver |
5.Re:求助:(applet/jdbc:odbc - AccessControlException: access denied) [Re: blackhorse_zou] | Copy to clipboard |
Posted by: 落魄 Posted on: 2005-10-13 09:07 俺在applet遇到了不能访问本地文件的问题,后来在google上找到的结果 Topic: Javascript call signed Applet會產生Access denied例外 http://www.javaworld.com.tw/jute/post/print?bid=29&id=75021 |
6.Re:求助:(applet/jdbc:odbc - AccessControlException: access denied) [Re: blackhorse_zou] | Copy to clipboard |
Posted by: blackhorse_zou Posted on: 2005-10-14 10:01 感谢各位的帮助! 我没有使用jdbc-odbc桥的方法连接数据库了!我现在使用的是直接连接数据库! 我下载了一个sql server 2000 driver for jdbc,按照上面的步骤安装,结果出现了以下的错误提示: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:162) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at MyInquireApplet.actionPerformed(MyInquireApplet.java:55) at java.awt.Button.processActionEvent(Button.java:382) at java.awt.Button.processEvent(Button.java:350) at java.awt.Component.dispatchEventImpl(Component.java:3615) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.EventQueue.dispatchEvent(EventQueue.java:456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Caused by: java.io.FileNotFoundException: C:\Documents and Settings\Administrator\桌面\com\microsoft\jdbc\sqlserver\SQLServerDriver.class (系统找不到指定的文件。) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156) at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:274) at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:4) at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152) at java.security.AccessController.doPrivileged(Native Method) at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149) ... 17 more 从错误提示看是因为:classpath的设置没有对! 可是我进入我电脑的环境变量设置里面没有classpath这一项,我自己添加了一个,按照说明输入了变量:安装路径+lib\msbase.jar lib\msutil.jar lib\mssqlserver.jar 但是仍然不行!后来我进入注册表找到了jvm的classpath,不知该如何添加,于是直接把路径添加在后面!可是还是不行! 那位前辈帮帮我!!!! |
7.Re:求助:(applet/jdbc:odbc - AccessControlException: access denied) [Re: blackhorse_zou] | Copy to clipboard |
Posted by: blackhorse_zou Posted on: 2005-10-14 10:10 再次感谢各位,我看了你们给我的网址的文章,真的谢谢你们! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |