标签:child cep dev exce eva obj junit4 except rman
C:\Java\jdk8\bin\java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\Installed\IntelliJ IDEA 2017.3.4\lib\idea_rt.jar=3706:D:\Installed\IntelliJ IDEA 2017.3.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\Installed\IntelliJ IDEA 2017.3.4\lib\idea_rt.jar;D:\Installed\IntelliJ IDEA 2017.3.4\plugins\junit\lib\junit-rt.jar;D:\Installed\IntelliJ IDEA 2017.3.4\plugins\junit\lib\junit5-rt.jar;C:\Java\jdk8\jre\lib\charsets.jar;C:\Java\jdk8\jre\lib\deploy.jar;C:\Java\jdk8\jre\lib\ext\access-bridge-64.jar;C:\Java\jdk8\jre\lib\ext\cldrdata.jar;C:\Java\jdk8\jre\lib\ext\dnsns.jar;C:\Java\jdk8\jre\lib\ext\jaccess.jar;C:\Java\jdk8\jre\lib\ext\jfxrt.jar;C:\Java\jdk8\jre\lib\ext\localedata.jar;C:\Java\jdk8\jre\lib\ext\nashorn.jar;C:\Java\jdk8\jre\lib\ext\sunec.jar;C:\Java\jdk8\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk8\jre\lib\ext\sunmscapi.jar;C:\Java\jdk8\jre\lib\ext\sunpkcs11.jar;C:\Java\jdk8\jre\lib\ext\zipfs.jar;C:\Java\jdk8\jre\lib\javaws.jar;C:\Java\jdk8\jre\lib\jce.jar;C:\Java\jdk8\jre\lib\jfr.jar;C:\Java\jdk8\jre\lib\jfxswt.jar;C:\Java\jdk8\jre\lib\jsse.jar;C:\Java\jdk8\jre\lib\management-agent.jar;C:\Java\jdk8\jre\lib\plugin.jar;C:\Java\jdk8\jre\lib\resources.jar;C:\Java\jdk8\jre\lib\rt.jar;D:\ideaworkspace\day02_oracle_jdbc\target\test-classes;E:\maven\SSMRepository\repository\com\oracle\ojdbc14\10.2.0.4.0\ojdbc14-10.2.0.4.0.jar;E:\maven\SSMRepository\repository\junit\junit\4.12\junit-4.12.jar;E:\maven\SSMRepository\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.itheima.test.TestJdbc,test02 java.sql.SQLException: ORA-06550: 第 1 行, 第 7 列: PLS-00201: 必须声明标识符 ‘PROC_COUNTYEARSAL‘ ORA-06550: 第 1 行, 第 7 列: PL/SQL: Statement ignored at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:212) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:951) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3390) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4223) at com.itheima.test.TestJdbc.test02(TestJdbc.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Process finished with exit code -1
异常的原因是因为在进行存储过程调用的中,数据库中没有该存储过程,
下面是我写的代码,因为在其他用户下面创建了一个存储过程,该用户下面并没有,而在进行数据库连接的时候连接了scott用户造成的,算是粗心造成的吧
@Test public void test02() throws Exception { String driver = "oracle.jdbc.OracleDriver"; String url = "jdbc:oracle:thin:@192.168.80.88:1521:orcl"; String username = "scott"; String password = "tiger"; Class.forName(driver); Connection connection = DriverManager.getConnection(url, username, password); CallableStatement pstm = connection.prepareCall("{call proc_countyearsal(?, ?)}"); //给参数赋值 pstm.setObject(1, 7788); pstm.registerOutParameter(2, OracleTypes.VARCHAR); //执行数据库查询操作 pstm.execute(); //输出结果[第二个参数] System.out.println(pstm.getObject(2)); //释放资源 pstm.close(); connection.close(); }
PL/SQL: Statement ignored 异常 关于存储过程的调用
标签:child cep dev exce eva obj junit4 except rman
原文地址:https://www.cnblogs.com/aniymx/p/10012350.html