简体   繁体   English

每个新的 session 都需要 dbms_java.grant_permission

[英]dbms_java.grant_permission is required for every new session

i am trying to implement java RMI client server connection, i made my server in NetBeans IDE and client class made in oracle database as java store procedure and use this via oracle function in my PLSQL block, everything is working fine but I stuck in little issue below: i am trying to implement java RMI client server connection, i made my server in NetBeans IDE and client class made in oracle database as java store procedure and use this via oracle function in my PLSQL block, everything is working fine but I stuck in little issue以下:

I made this java store procedure in SYSTEM user and give dbms_java.grant_permission('SYSTEM','java.net.SocketPermission','192.168.43.25:*','connect,resolve') to SYSTEM user via SYSDBA, "*" is used for all available ports.我在 SYSTEM 用户中创建了这个 java 存储过程,并通过 SYSDBA 将dbms_java.grant_permission('SYSTEM','java.net.SocketPermission','192.168.43.25:*','connect,resolve')给 SYSTEM 用户用于所有可用端口。 I get perfect response from my server but till specific session expiry.我从我的服务器得到了完美的响应,但直到特定的 session 到期。

Whenever I logout from SYSTEM user and login back again, its again throws me an exception the Permission ("java.net.SocketPermission" "192.168.43.25:56792" "connect,resolve") has not been granted please guide me how can I get rid from this repeated task?每当我从 SYSTEM 用户注销并再次登录时,它再次向我抛出一个异常the Permission ("java.net.SocketPermission" "192.168.43.25:56792" "connect,resolve") has not been granted请指导我我该怎么做摆脱这个重复的任务? because in development environment I'll manage it but how can deploy it on production with this issue.因为在开发环境中我会管理它,但是如何在生产环境中部署它。 My Environment is Oracle DB 18c XE, Thank You!我的环境是 Oracle DB 18c XE,谢谢!

Following is my java store procedure:以下是我的 java 存储过程:

create or replace and compile java source named rmi as
package rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.Naming;
import java.security.Policy;




 public class RmiClient {

    public RmiClient(){
    }

    public static String getRequestFromClient(){
        Policy.setPolicy(new MyPolicy());
        String result = "";
        try {
            IServer server = getServer();
            result = server.getRequestFromClient();
        } catch (Exception ex) {
            result = ex.getMessage().toString();
        }
        return result;

    }
    private static IServer getServer() throws Exception {
        Parameter configurationParameters = new Parameter();
        IServer server = (IServer) Naming.lookup( configurationParameters.objectName);

        return server;
    }
    }

Granting permissions with DBMS_JAVA is a little different than a typical Oracle grant.使用DBMS_JAVA授予权限与典型的 Oracle 授予略有不同。 After granting a permission using DBMS_JAVA.GRANT_PERMISSION , you will need to COMMIT at some point after the grant as been executed for it to take affect permanently.使用DBMS_JAVA.GRANT_PERMISSION授予权限后,您需要在授予执行后的某个时间COMMIT以使其永久生效。 Notice how there is a COMMIT after the DBMS_JAVA call in the Oracle documentation .请注意Oracle 文档中的DBMS_JAVA调用之后如何有一个COMMIT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM