JAVA大字段操作

<%@ page import="com.apex.util.ApexRowSet" pageEncoding="UTF-8" isErrorPage="false" %>
<%@ page import="com.apex.workflow.WorkUtil" %>
<%@ page import="com.opensymphony.workflow.WorkflowException" %>
<%@ page import="org.apache.log4j.Logger" %>
<%@ page import="plugins.utils.ParamUtils" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.LinkedList" %>
<%@ page import="org.apache.commons.fileupload.*" %>
<%@ page import="java.io.*" %>
<%@ page import="com.apex.form.*" %>
<%@ page import="com.apex.form.context.*" %>
<%@ page import="com.apex.form.operate.*" %>
<%@ page import="plugins.bean.DatabaseUtils" %>
<%@ page import="plugins.bean.OutDB" %>
<%@ page import="plugins.utils.StringUtils" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.apex.livebos.fix.*" %>
<%@ page import="plugins.utils.LivebosUtil" %>
<%@ page import="com.apex.util.Util" %>
<%@ page import="jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager" %>
<%@ page import="com.apex.zkapi.FPCom.FPProcess" %>
<%@ page import="com.apex.zkapi.FPCom.IFPProcess" %>
<%@ page import="jp.ne.so_net.ga2.no_ji.jcom.JComException" %>
<%
 //out.print("正在处理证件图片......");
 DatabaseUtils db;
 db = new OutDB().getDB();
 String khh = request.getParameter("photoKHH");
    String BASE64Str = request.getParameter("photo64code");
    java.sql.PreparedStatement ps = null;
 StringBuffer sql = new StringBuffer();
 ResultSet rs=null;
 System.out.println("111111111111111111111"+khh);
    System.out.println("BASE64Str"+BASE64Str);
    if (BASE64Str != null && khh != null)
    {
        int recode = 0;
        try {
            rs=db.getConnection().createStatement().executeQuery("SELECT KHH FROM tKHTXLSB WHERE KHH='"+khh+"'");
            if(rs.next())
            {
             sql.append("UPDATE tKHTXLSB SET ZJ=? WHERE KHH=?");
            }
            else
            {
             sql.append("INSERT INTO tKHTXLSB(ZJ,KHH) values(?,?)");
            }
            ps = db.getConnection().prepareStatement(sql.toString());
            String fileName = "二代证相片.bmp";
            java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
            bos.write(fileName.getBytes().length);
            bos.write(fileName.getBytes());
            bos.write(new sun.misc.BASE64Decoder().decodeBuffer(BASE64Str));
            byte[] by = bos.toByteArray();
            java.io.ByteArrayInputStream bis = new ByteArrayInputStream(by);
            ps.setBinaryStream(1, bis, bis.available());
            ps.setString(2, khh);
            recode = ps.executeUpdate();
            rs.close();
        } catch (Exception e)
        {
            //throw new SQLException("" + e.getMessage());
            rs.close();
            out.print(e);
        }
    }
%>

 

你可能感兴趣的:(java)