[英]java.sql.SQLException: ORA-06550: line 1, column 13: After granting user permission to EXECUTE package
I've spent months developing a JAVA application with a Oracle db back-end. 我花了几个月的时间用Oracle db后端开发一个JAVA应用程序。 I am using Netbeans as my IDE and Oracle 12c on a laptop as my database.
我在笔记本电脑上使用Netbeans作为我的IDE和Oracle 12c作为我的数据库。 All PL/SQL has been compiled with no errors.
所有PL / SQL都已编译,没有错误。
After extensive testing (logged in as the schema owner), I attempted to add a user. 经过大量测试(以架构所有者身份登录)后,我尝试添加用户。 I created the user, logged in as SYS_DBA, using
CREATE USER E566299 IDENTIFIED BY tempPswrd
, then granted permission using GRANT CREATE SESSION
and GRANT EXECUTE ON C##FAI_CODE.FAI_ADMIN_PKG TO E566299
and received Grant succeeded
confirmation. 我使用
CREATE USER E566299 IDENTIFIED BY tempPswrd
创建了用户,以SYS_DBA身份登录,然后使用GRANT CREATE SESSION
和GRANT EXECUTE ON C##FAI_CODE.FAI_ADMIN_PKG TO E566299
授予权限,并收到Grant succeeded
确认。
I login to my application, as this new user, with no errors using the following: 我作为这个新用户登录我的应用程序,使用以下内容没有错误:
private static Connection getDbConn(String user, String password) throws SQLException{
OracleDataSource ods = null;
Connection dbConn = null;
user = "c##" + user;
ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//localhost:1522/orcl.global.ds.XXXXXXXX.com");
ods.setUser(user);
ods.setPassword(password);
dbConn = ods.getConnection();
return dbConn;
}
Then it throws an error on the first package procedure call: 然后它在第一个包过程调用上抛出一个错误:
java.sql.SQLException: ORA-06550: line 1, column 13: PLS-00201: identifier 'FAI_ADMIN_PKG.CHECK_USER_FOLLOWED' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
java.sql.SQLException:ORA-06550:第1行第13列:PLS-00201:必须声明标识符'FAI_ADMIN_PKG.CHECK_USER_FOLLOWED'ORA-06550:第1行第7列:PL / SQL:语句被忽略
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:210) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:53) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:938) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3820) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3923) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5617) at oracle.jdbc.dri
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017) )oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655)at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java: 566)oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:210)at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:53)at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java) :938)at oracle.jdbc.driver.OraclePreparedStatement.exe(OraclePreparedStatement。 java:3923)在oracle.jdbc.dri的oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5617) ver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1385) at faidb.FAIdb.checkSubscription(FAIdb.java:549) at faidb.faidbUI.run(faidbUI.java:186) at faidb.faidbLogin$3.run(faidbLogin.java:133) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
ver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1385)at faidb.FAIdb.checkSubscription(FAIdb.java:549)at faidb.faidbUI.run(faidbUI.java:186)faidb.faidbLogin $ 3.run(faidbLogin.java: 133)at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
I'm at a loss, I've tried every possible combination of grant wording, all caps, all lowercase, single quotes, double quotes, with the schema owner name prefix C##FAI_CODE.FAI_ADMIN_PKG
, without FAI_ADMIN_PKG
, nothing will allow this new user to execute the package. 我很茫然,我尝试了所有可能的授权措辞,全部大写,全部小写,单引号,双引号,模式所有者名称前缀为
C##FAI_CODE.FAI_ADMIN_PKG
,没有FAI_ADMIN_PKG
,什么都不会允许这个新的用户执行包。
I've spent considerable time on this project and am near panic that no one will be able to use it. 我花了相当多的时间在这个项目上,并且几乎没有人能够使用它。
Question: 题:
Why can't my newly created user execute a package after being granted permission? 为什么我的新创建的用户在被授予权限后不能执行包?
Edit: 编辑:
I get a NullPointerException
on the last line with the call to rset.close();
我通过调用
rset.close();
在最后一行得到一个NullPointerException
rset.close();
, the result set is never initialized but it doesn't throw a SQLException
,结果集永远不会初始化,但它不会抛出
SQLException
public Vector<String> fillBox() throws SQLException, NullPointerException{
CallableStatement callStatement = null;
ResultSet rset = null;
String fillBox = "{call fai_admin_pkg.get_end_item_pn(?)}";
Vector<String> boxFill = new Vector<>();
try{
callStatement = conn.prepareCall(fillBox);
callStatement.registerOutParameter(1, OracleTypes.CURSOR);
callStatement.execute();
rset = (ResultSet) callStatement.getObject(1);
boxFill = buildRsVector(rset);
}
finally{
callStatement.close();
rset.close();
}
return boxFill;
}
That is called here: 这称为:
Vector<String> boxFill = new Vector<>();
try{
boxFill = uiInst.fillBox();
}catch(SQLException e){
JOptionPane.showMessageDialog(frame, e.getMessage());
}catch(NullPointerException e){
JOptionPane.showMessageDialog(frame, e.getMessage());
e.printStackTrace();
}
Here are my permissions as the new user...which do not include execute on the package?? 这是我作为新用户的权限...不包括在包上执行? I'm not understanding
我不理解
Problem solved. 问题解决了。 Not having a global synonym set or
current_schema
for the new user's session set to the package owner results in any calls to the owners package procedures requiring the owner's prefix: <package owner>.<package>.<procedure>
. 如果新用户的会话设置为包所有者没有全局同义词集或
current_schema
,则会导致对所有者包过程的任何调用都需要所有者的前缀: <package owner>.<package>.<procedure>
。 The calls I was making under the new user were only to <package>.<procedure>
resulting in a SQLException
being thrown because to the compiler that package doesn't exist. 我在新用户下进行的调用只是
<package>.<procedure>
导致SQLException
,因为编译器不存在该包。
Additionally, I will research both global synonyms and user sessions to avoid having to use this quick fix. 此外,我将研究全局同义词和用户会话,以避免使用此快速修复。
Thanks for the help! 谢谢您的帮助!
create session just allow you to login to the database. create session只允许您登录数据库。 you might need others permission to do what you want to do.
你可能需要其他人的许可来做你想做的事。
you can refer to this link for help 您可以参考此链接获取帮助
https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljgrant.html https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljgrant.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.