历史吧 关注:4,006,901贴子:72,468,001
  • 3回复贴,共1

哪位老哥可以帮我看一下,我这个从eclipse向Oracle中插入blob错

只看楼主收藏回复


谁能帮我看一下,这个从eclipse向Oracle中插入blob数据错在哪里?


1楼2017-05-23 13:12回复
    java.lang.AbstractMethodError: oracle.jdbc.driver.T4CPreparedStatement.setBlob(ILjava/io/InputStream;)V
    at com.atguigu.jdbc.JDBCTest.testInsertBlob(JDBCTest.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    这是报出的错误


    2楼2017-05-23 13:13
    回复
      @Test
      public void testInsertBlob(){
      Connection connection=null;
      PreparedStatement preparedStatement=null;
      try {
      connection=JDBCTools.getConnection();
      String sql = "INSERT INTO customers(name, email, birth,picture)" +
      "VALUES(?,?,?,?)";
      preparedStatement=connection.prepareStatement(sql);
      preparedStatement.setString(1,"ABCDE");
      preparedStatement.setString(2,"abce@qq.com");
      preparedStatement.setDate(3,
      new Date(new java.util.Date().getTime()));
      InputStream inputstream=new FileInputStream("柳岩.jpg");
      preparedStatement.setBlob(4, inputstream);
      preparedStatement.executeUpdate(sql);
      } catch (Exception e) {
      e.printStackTrace();
      }finally{
      JDBCTools.releaseDB(null, preparedStatement, connection);
      }
      }
      这是使用的jdbc程序


      3楼2017-05-23 13:14
      回复
        麻烦请教一下吧里的大神~


        5楼2017-05-23 13:14
        回复