JDBC 操作插入表出現javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB

來源:互聯網
上載者:User

標籤:

/**     * 介面方法     */    public void excuteInputDB(SynchServiceConfig synchServiceConfig)            throws Exception {        try {//          if(!"".equals(queryQdParaWayinfo()))//          {//              CLOB clob = oracle.sql.CLOB.createTemporary(oraConn, false, oracle.sql.CLOB.DURATION_SESSION);//              clob.putString(1, queryQdParaWayinfo());//             //              insertMyAnnouncement(VALID_WAYINFO_SENDER, curTime, VALID_WAYINFO_TITTLE, clob);//渠道資料缺失提醒推送//          }          if(!"".equals(queryQdSysNetpointuser())){              //將String類型轉oracle.sql.CLOB類型插入到資料庫              CLOB cb = oracle.sql.CLOB.createTemporary(oraConn, false, oracle.sql.CLOB.DURATION_SESSION);              cb.putString(1, queryQdSysNetpointuser());             insertQdSysNetpointuser(VALID_WAYINFO_SENDER, curTime, VALID_EMPLOYEE_TITTLE, cb);//營業員資料缺失提醒推送          }          System.out.println("===測試模組END==");        } catch (Exception e) {            e.printStackTrace();        }    }    /**     * 擷取缺失的渠道資料的資料     * @throws SQLException      */    private String queryQdParaWayinfo() throws SQLException {        /**         * way.id-- id vc_wayacctname-- 渠道經理連絡人 way.c_wayid-- 網點編號 vc_acctname--         * 銀行帳戶名稱 vc_acctbank-- 開戶銀行 vc_wayacctno-- 銀行帳號 dept_sx1-- 渠道屬性         * c_accttype-- 帳戶類型 si_chain-- 店鋪屬性 c_type-- 連鎖屬性 dept_sx3-- 星級         * way.manager_name--渠道經理         */        String msg = "";        String msgs = "";                PreparedStatement ps = null;        ResultSet rs = null;                String sql = "select way.id, "                + " NVL(way.vc_wayacctname, ‘ ‘) AS vc_wayacctname, "                + " NVL(way.c_wayid, ‘ ‘) AS c_wayid, "                + " NVL(way.vc_acctname, ‘ ‘) AS vc_acctname, "                + " NVL(way.vc_acctbank, ‘ ‘) AS vc_acctbank, "                + " NVL(way.vc_wayacctno, ‘ ‘) AS vc_wayacctno, "                + " NVL(way.dept_sx1, ‘ ‘) AS dept_sx1, "                + " NVL(way.c_accttype, ‘ ‘) AS c_accttype,"                + " NVL(way.si_chain, -9) AS si_chain, "                + " NVL(way.c_type, ‘ ‘) AS c_type, "                + " NVL(way.dept_sx3, ‘ ‘) AS dept_sx3, "                + " NVL(way.manager_name, ‘ ‘) AS manager_name "                + " from qd_para_wayinfo way where regexp_like(way.c_wayid,‘QD[0-9]{6}‘) and way.si_waystate = 1 ";        System.out.println("sql......"+sql);        try {            ps = oraConn.prepareStatement(sql);            rs = ps.executeQuery();                        while (rs.next()) {                                if ("".equals(rs.getString("vc_acctname").trim())) {                    msg = msg + "銀行帳戶名稱為空白,";                }                if ("".equals(rs.getString("vc_acctbank").trim())) {                    msg = msg + "開戶銀行為空白,";                }                if ("".equals(rs.getString("vc_wayacctno").trim())) {                    msg = msg + "銀行帳號為空白,";                }                if ("".equals(rs.getString("dept_sx1").trim())) {                    msg = msg + "渠道屬性為空白,";                }                if ("".equals(rs.getString("c_accttype").trim())) {                    msg = msg + "帳戶類型為空白,";                }                if (rs.getInt("si_chain") == -9) {                    msg = msg + "店鋪屬性為空白,";                }                if (rs.getInt("si_chain") == 3                        && "".equals(rs.getString("c_type").trim())) {                    msg = msg + "連鎖屬性為空白,";                }if("".equals(rs.getString("c_wayid").trim())) {                    msg = msg + "渠道編號為空白";                }                if ("".equals(rs.getString("dept_sx3").trim())) {                    msg = msg + "星級為空白";                }                if (!"".equals(msg)) {                                        msgs = msgs + rs.getString("manager_name") + "|"                            + rs.getString("c_wayid") + "|" + msg+"|";                                    }                msg = "";            }        } catch (Exception e) {            e.printStackTrace();        }finally{            if(rs !=null){rs.close();}            if(ps !=null){ps.close();}        }                return msgs;    }    /**     * 插入公告表 qd_anno_myAnnouncement     * @throws SQLException      * */    private boolean insertMyAnnouncement(long sender,Date send_time,String title,Clob cb) throws SQLException{                        boolean flag = false;        PreparedStatement psInsert = null;                SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");                try {            String sql =                "insert into qd_anno_myannouncement(id, sender , send_time , title , content ) " +                "select qd_anno_myannouncement_seq.nextval,? , ? , ? ,?  from dual ";            psInsert = oraConn.prepareStatement(sql);            psInsert.setLong(1, sender);                        psInsert.setTimestamp(2, Timestamp.valueOf(sf.format(send_time)));                psInsert.setString(3, title);                        psInsert.setClob(4, cb);                        int num  = psInsert.executeUpdate();                        if(num > 0){                flag = true;                            }            oraConn.commit();        } catch (Exception e) {            e.printStackTrace();            oraConn.rollback();        }finally{              if(psInsert !=null){psInsert.close();}            }            return flag;    }

 

JDBC 操作插入表出現javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.