当前位置:  技术问答>java相关

jspsmart中无法把文件上传到数据库中

    来源: 互联网  发布时间:2015-03-16

    本文导语:  我下载了jspsmart,可以将文件上传到服务器上的一个文件目录中,但是却无法把文件上传到数据库中,请高手指教! 系统环境是:window2000server+Jrun+sqlserver2000 | package com.landmis.archiveMGMT.module; impor...

我下载了jspsmart,可以将文件上传到服务器上的一个文件目录中,但是却无法把文件上传到数据库中,请高手指教!
系统环境是:window2000server+Jrun+sqlserver2000

|
package com.landmis.archiveMGMT.module;

import com.landmis.archiveMGMT.view.ArchiveFileBean;
import com.landmis.storage.DBOperation;
import com.landmis.util.LandProperty;
import java.io.File;
import java.io.PrintStream;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ArchiveFileProxyBean
{

    public ArchiveFileProxyBean()
    {
        docmentId = 0;
    }

    public int getDocmentId()
    {
        return docmentId;
    }

    public int saveArchiveFile(ArchiveFileBean archivefilebean)
    {
        int i = 0;
        int j = 0;
        String s = "";
        String s1 = "";
        String s2 = "";
        java.util.Date date = null;
        int k = 0;
        String s3 = "";
        String s4 = "";
        String s5 = "";
        String s6 = "";
        int l = 0;
        i = archivefilebean.getArchiveId();
        j = archivefilebean.getFileId();
        s = archivefilebean.getDocId();
        s1 = archivefilebean.getDutier();
        s2 = archivefilebean.getFileName();
        date = archivefilebean.getInputFileDate();
        k = archivefilebean.getDocPageNumber();
        s3 = archivefilebean.getLimitDate();
        s4 = archivefilebean.getDocWhere();
        s6 = archivefilebean.getRemark();
        DBOperation dboperation = null;
        try
        {
            try
            {
                dboperation = new DBOperation();
                docmentId = DBOperation.getSequenceId("S_ARCHIVE_FILE");
                String s7 = "insert into archive_file values(" + docmentId + "," + i + "," + j + ",'" + s + "','" + s1 + "','" + s2 + "',TO_DATE('" + new Date(date.getTime()) + "','YYYY-MM-DD')," + k + ",'" + s3 + "','" + s4 + "','" + s5 + "','" + s6 + "'," + l + ")";
                int i1 = dboperation.executeUpdate(s7);
                int j1 = i1;
                return j1;
            }
            catch(SQLException sqlexception)
            {
                System.err.println(sqlexception);
                sqlexception.printStackTrace();
            }
        }
        finally
        {
            dboperation.closeConnection();
        }
        return 0;
    }

    public int updateArchiveFile(ArchiveFileBean archivefilebean)
    {
        int i = 0;
        int j = 0;
        int k = 0;
        String s = "";
        String s1 = "";
        String s2 = "";
        java.util.Date date = null;
        int l = 0;
        String s3 = "";
        String s4 = "";
        String s5 = "";
        i = archivefilebean.getDocmentId();
        j = archivefilebean.getArchiveId();
        k = archivefilebean.getFileId();
        s = archivefilebean.getDocId();
        s1 = archivefilebean.getDutier();
        s2 = archivefilebean.getFileName();
        date = archivefilebean.getInputFileDate();
        l = archivefilebean.getDocPageNumber();
        s3 = archivefilebean.getLimitDate();
        s4 = archivefilebean.getDocWhere();
        s5 = archivefilebean.getRemark();
        DBOperation dboperation = null;
        try
        {
            try
            {
                dboperation = new DBOperation();
                String s6 = " update archive_file set FILE_ID=" + k + ",DOC_ID='" + s + "',DUTIER='" + s1 + "',FILE_NAME='" + s2 + "',FILE_DATE=TO_DATE('" + new Date(date.getTime()) + "','YYYY-MM-DD')" + ",DOC_PAGE_NUMBER=" + l + ",LIMIT_DATE='" + s3 + "',DOC_WHERE='" + s4 + "',REMARK='" + s5 + "' where DOCMENT_ID=" + i;
                System.out.println("sqlstate = " + s6);
                int i1 = dboperation.executeUpdate(s6);
                int j1 = i1;
                return j1;
            }
            catch(SQLException sqlexception)
            {
                System.err.println(sqlexception);
                sqlexception.printStackTrace();
            }
        }
        finally
        {
            dboperation.closeConnection();
        }
        return 0;
    }

    public int deleteArchiveFile(ArchiveFileBean archivefilebean)
    {
        int i = -1;
        String s = "Y";
        i = archivefilebean.getDocmentId();
        System.out.println("success .........");
        System.out.println("DELMARK = " + s);
        try
        {
            DBOperation dboperation = new DBOperation();
            String s1 = " update archive_file set DELMARK= '" + s + "' where DOCMENT_ID=" + 1;
            System.out.println("sqlstate = " + s1);
            int j = dboperation.executeUpdate(s1);
            return j;
        }
        catch(SQLException sqlexception)
        {
            System.err.println(sqlexception);
            sqlexception.printStackTrace();
            return 0;
        }
    }

    public String getFilePath(int i)
    {
        String s;
label0:
        {
            ResultSet resultset = null;
            DBOperation dboperation = null;
            int j = 0;
            s = null;
            try
            {
                try
                {
                    try
                    {
                        dboperation = new DBOperation();
                        String s1 = "select archives_id from archives_info where archives_id = " + i;
                        resultset = dboperation.executeQuery(s1);
                        if(resultset.next())
                            j = resultset.getInt(1);
                        LandProperty landproperty = new LandProperty();
                        String s2 = landproperty.getProperty("BASIC_PATH");
                        s = "files/archive/archive_" + j;
                        File file = new File(s2 + s);
                        file.mkdirs();
                        System.out.print("created " + file);
                    }
                    catch(SQLException sqlexception)
                    {
                        System.err.println(sqlexception);
                        sqlexception.printStackTrace();
                    }
                    break label0;
                }
                finally
                {
                    resultset.close();
                    dboperation.closeConnection();
                }
            }
            catch(Exception exception)
            {
                exception.printStackTrace();
            }
        }
        return s;
    }

    private int docmentId;
}


引用




success




    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • 哪里可以下载com.jspsmart.这个包包呢?在线等待。。。定有重酬
  • com.jspsmart.upload问题
  • 有谁知道jspsmart的jspsmartupload的源码
  • http://www.jspsmart.com/的jspSmartUpload使用求助!


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3