我略微有点头绪了,在我的数据库连接gisconn中,我没有定义PreparedStatement,可能是这个错误吧!那各位大虾,我该如何定义这个PreparedStatement方法呢??请赐教!

解决方案 »

  1.   

    我转化了思路,现在没有出现错误,但是数据库中却插不了记录以下这个程序,运行的时候没有报错,但是不能把数据插到数据库中去,为什么啊?我晕了!
    <%  
      Class.forName("oracle.jdbc.driver.OracleDriver");
      Connection conn= DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:wjg","bbs","bbs");
      conn.setAutoCommit(false);
      Statement stmt=conn.createStatement();
      //File file=new File("c:\\a.gif");
      //InputStream is=new FileInputStream(file);
      //System.out.print(file.length());
      //PreparedStatement pstmt=conn.prepareStatement("INSERT INTO img values(?)");
      PreparedStatement pstmt=conn.prepareStatement("insert into img(id,pic) values('123',empty_blob())"); 
      //pstmt.setString(1, "123");
      //pstmt.setBlob(2, empty_blob());  //pstmt.setBinaryStream(1,is,(int)file.length());
      pstmt.executeUpdate();
      pstmt.close(); 
    %> 
    能指导吗?