用getString()在运行时会产生内存冲突错误,把weblogic服务器停止,可能是数据太多的原因。 

解决方案 »

  1.   

    4. Streams: Long columns in JDBC are streamed.   
       * To set a long (Stream) column
         pstmt.setAsciiStream (1, <input-stream>, <input-stream-length>);     If the string data is in Unicode format, then use setUnicodeStream.
         pstmt.setUnicodeStream (1, <input-stream>, <input-stream-length>);     For long raw columns, use setBinaryStream
         pstmt.setBinaryStream (1, <input-stream>, <input-stream-length>);
       
         create table streamexample (data long)     PreparedStatement pstmt =
          conn.prepareStatement ("insert into streamexample values (?)");
         InputStream is = new FileInputStream ("notes.txt");
         File file = new File ("notes.txt");
         pstmt.setAsciiStream (1, is, (int)file.length ());   
       * To retrieve a long column
         ResultSet rset =
          stmt.executeQuery ("select * from streamexample");
         
         InputStream ascii_data = rset.getAsciiStream (1);     // Loop, reading from the gif stream and writing to the file
         int c;
         while ((c = ascii_data.read ()) != -1)
            Systemm.out.print(c);