简体   繁体   English

PLS-00201:必须声明标识符“DBMS_SODA_ADMIN.DESCRIBE_COLLECTION”

[英]PLS-00201: identifier 'DBMS_SODA_ADMIN.DESCRIBE_COLLECTION' must be declared

I am using SODA for Java to store and retrieve documents from oracle 12c DB.我正在使用SODA for Java从 oracle 12c DB 存储和检索文档。 I am following this example .我正在关注这个例子

I am getting exception after the execution of the code.执行代码后出现异常。

oracle.soda.rdbms.impl.SODAUtils$1OracleSQLException at oracle.soda.rdbms.impl.SODAUtils.makeExceptionWithSQLText(SODAUtils.java:112) at oracle.soda.rdbms.impl.SODAUtils.makeExceptionWithSQLText(SODAUtils.java:75) at oracle.soda.rdbms.impl.OracleDatabaseImpl.loadCollection(OracleDatabaseImpl.java:1338) at oracle.soda.rdbms.impl.OracleDatabaseImpl.openCollection(OracleDatabaseImpl.java:410) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection(OracleDatabaseImpl.java:348) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection(OracleDatabaseImpl.java:332) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection(OracleDatabaseImpl.java:321) at oracle.soda.rdbms.impl.OracleDatabaseImpl.access$100(OracleDatabaseImpl.java:62) at oracle.soda.rdbms.impl.OracleDatabaseImpl$OracleDatabaseAdministrationImpl.createCollection(OracleDatabaseImpl.java:1798) at com.cisco.salesconnect.lms.TestSoda.main(TestSoda.java:26) Caused by: java.sql.SQLException: ORA-06550: line 2, column 3: oracle.soda.rdbms.impl.SODAUtils$1OracleSQLException at oracle.soda.rdbms.impl.SODAUtils.makeExceptionWithSQLText(SODAUtils.java:112) at oracle.soda.rdbms.impl.SODAUtils.makeExceptionWithSQLText(SODAUtils.java:75) at oracle.soda.rdbms.impl.OracleDatabaseImpl.loadCollection(OracleDatabaseImpl.java:1338) at oracle.soda.rdbms.impl.OracleDatabaseImpl.openCollection(OracleDatabaseImpl.java:410) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection( OracleDatabaseImpl.java:348) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection(OracleDatabaseImpl.java:332) at oracle.soda.rdbms.impl.OracleDatabaseImpl.createCollection(OracleDatabaseImpl.java:321) at oracle.soda.rdbms .impl.OracleDatabaseImpl.access$100(OracleDatabaseImpl.java:62) at oracle.soda.rdbms.impl.OracleDatabaseImpl$OracleDatabaseAdministrationImpl.createCollection(OracleDatabaseImpl.java:1798) at com.cisco.salesconnect.lms.TestSoda.main(TestSoda. java:26) 引起:java.sql.SQLException:ORA-06550:第 2 行,第 3 列: PLS-00201: identifier 'DBMS_SODA_ADMIN.DESCRIBE_COLLECTION' must be declared ORA-06550: line 2, column 3: PL/SQL: Statement ignored at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1041) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685) at oracle.jdbc.driver.OracleCallableStatement.execute(Or PLS-00201:标识符“DBMS_SODA_ADMIN.DESCRIBE_COLLECTION”必须声明 ORA-06550:第 2 行,第 3 列:PL/SQL:oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdb 中的语句被忽略.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) at oracle.jdbc.driver.T4CTTTIfun.receive(T4CTTIoer.java.450) atacle jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:2) .jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1041) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement)java: oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685) at oracle.jdbc.driver.OracleCallableStatement.execute(或acleCallableStatement.java:4714) at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376) at oracle.soda.rdbms.impl.OracleDatabaseImpl.loadCollection(OracleDatabaseImpl.java:1317) ... 7 more acleCallableStatement.java:4714) at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376) at oracle.soda.rdbms.impl.OracleDatabaseImpl.loadCollection(OracleDatabaseImpl.java:1317) ... 7 更多

Java Code Java代码

try(OracleConnection conn = (OracleConnection) DriverManager.getConnection(/*connection url*/)) {

        conn.setImplicitCachingEnabled(true);
        conn.setStatementCacheSize(50);

        OracleRDBMSClient cl = new OracleRDBMSClient();

        OracleDatabase db = cl.getDatabase(conn);

        db.admin().createCollection("MyFirstJSONCollection");

    } catch (SCExceptions | SQLException | OracleException e) {
        e.printStackTrace();
    }
}

What will be the reason behind this exception?这个异常背后的原因是什么?

Did you grant SODA_APP role to the user under which you're creating the collection?您是否向正在创建集合的用户授予 SODA_APP 角色? eg:例如:

grant SODA_APP to userNameHere;将 SODA_APP 授予 userNameHere;

The error you're getting would happen if you didn't.如果你不这样做,你得到的错误就会发生。

Somewhere in the code which gets executed when you call db.admin().createCollection("MyFirstJSONCollection");在调用db.admin().createCollection("MyFirstJSONCollection");时执行的代码中的某处db.admin().createCollection("MyFirstJSONCollection"); a reference is being made to an object called DBMS_SODA_ADMIN.DESCRIBE_COLLECTION which does not exist in the database.正在引用数据库中不存在的名为DBMS_SODA_ADMIN.DESCRIBE_COLLECTION的对象。 You should check and see if the schema DBMS_SODA_ADMIN exists, and if there is an object called DESCRIBE_COLLECTION in that schema.您应该检查并查看模式DBMS_SODA_ADMIN存在,以及该模式中DBMS_SODA_ADMIN存在名为DESCRIBE_COLLECTION的对象。 One way to do that would be to execute a query such as一种方法是执行查询,例如

SELECT *
  FROM DBA_USERS u
  WHERE u.USERNAME = 'DBMS_SODA_ADMIN'

SELECT *
  FROM DBA_OBJECTS o
  WHERE o.OWNER = 'DBMS_SODA_ADMIN' AND
        o.OBJECT_NAME = 'DESCRIBE_COLLECTION'

If either is missing it indicates that the installation of the Soda database components was either not performed, or did not complete successfully.如果缺少其中一个,则表明 Soda 数据库组件的安装要么未执行,要么未成功完成。 If these things do exist it indicates that the user your codes connects as does not have the permissions needed to access this object.如果这些东西确实存在,则表明您的代码连接的用户没有访问此对象所需的权限。

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

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