zoukankan      html  css  js  c++  java
  • java附件上传下载大字段版

    public int up2(Map map) {
            StringBuffer insertSQL = new StringBuffer();
            insertSQL.append("insert T_Sys_Attachment");
            insertSQL.append("(Id,A_OwnerId,A_Size,A_Title,A_Body,Type,A_Category,A_OwnerXh");
            insertSQL.append(")values(?,?,?,?,?,?,?,?) ");
    
            InputStream is = null;
            int row = 0;
            try {
                con.setAutoCommit(false);
                ps = con.prepareStatement(insertSQL.toString());
                /*
                 * this.del(String.valueOf(map.get("a_ownerid")),
                 * String.valueOf(map.get("type")));
                 */
                ps.setObject(1, map.get("id"));
                ps.setObject(2, map.get("a_ownerid"));
                ps.setObject(3, map.get("a_size"));
                ps.setObject(4, map.get("a_title"));
                is = new FileInputStream((File) map.get("a_body"));
                ps.setBinaryStream(5, is, is.available());
                ps.setObject(6, map.get("type"));
                ps.setObject(7, map.get("a_category"));
                ps.setObject(8, map.get("a_ownerxh"));
                row = ps.executeUpdate();
                con.commit();
    
            } catch (SQLException e) {
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                this.close();
            }
            return row;
        }
  • 相关阅读:
    Log4Net记录到MySql
    创建快照
    grep的用法(CentOS7)及有关正则表达式的使用
    samba
    mkdir
    raid0和raid5的 实验过程
    route
    source和sh执行脚本时的差异
    echo命令的简单用法和实例
    smbpasswd和pdbedit
  • 原文地址:https://www.cnblogs.com/fxfly/p/4784809.html
Copyright © 2011-2022 走看看