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

数据库   发布日期:2025年07月05日   浏览次数:144
  1. /**
  2. * 接口方法
  3. */
  4. public void excuteInputDB(SynchServiceConfig synchServiceConfig)
  5. throws Exception {
  6. try {
  7. // if(!"".equals(queryQdParaWayinfo()))
  8. // {
  9. // CLOB clob = oracle.sql.CLOB.createTemporary(oraConn, false, oracle.sql.CLOB.DURATION_SESSION);
  10. // clob.putString(1, queryQdParaWayinfo());
  11. //
  12. // insertMyAnnouncement(VALID_WAYINFO_SENDER, curTime, VALID_WAYINFO_TITTLE, clob);//渠道资料缺失提醒推送
  13. // }
  14. if(!"".equals(queryQdSysNetpointuser())){
  15. //将String类型转oracle.sql.CLOB类型插入到数据库
  16. CLOB cb = oracle.sql.CLOB.createTemporary(oraConn, false, oracle.sql.CLOB.DURATION_SESSION);
  17. cb.putString(1, queryQdSysNetpointuser());
  18. insertQdSysNetpointuser(VALID_WAYINFO_SENDER, curTime, VALID_EMPLOYEE_TITTLE, cb);//营业员资料缺失提醒推送
  19. }
  20. System.out.println("===测试模块END==");
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. /**
  26. * 获取缺失的渠道资料的数据
  27. * @throws SQLException
  28. */
  29. private String queryQdParaWayinfo() throws SQLException {
  30. /**
  31. * way.id-- id vc_wayacctname-- 渠道经理联系人 way.c_wayid-- 网点编号 vc_acctname--
  32. * 银行帐户名 vc_acctbank-- 开户银行 vc_wayacctno-- 银行帐号 dept_sx1-- 渠道属性
  33. * c_accttype-- 帐户类型 si_chain-- 店铺属性 c_type-- 连锁属性 dept_sx3-- 星级
  34. * way.manager_name--渠道经理
  35. */
  36. String msg = "";
  37. String msgs = "";
  38. PreparedStatement ps = null;
  39. ResultSet rs = null;
  40. String sql = "select way.id, "
  41. + " NVL(way.vc_wayacctname, ' ') AS vc_wayacctname, "
  42. + " NVL(way.c_wayid, ' ') AS c_wayid, "
  43. + " NVL(way.vc_acctname, ' ') AS vc_acctname, "
  44. + " NVL(way.vc_acctbank, ' ') AS vc_acctbank, "
  45. + " NVL(way.vc_wayacctno, ' ') AS vc_wayacctno, "
  46. + " NVL(way.dept_sx1, ' ') AS dept_sx1, "
  47. + " NVL(way.c_accttype, ' ') AS c_accttype,"
  48. + " NVL(way.si_chain, -9) AS si_chain, "
  49. + " NVL(way.c_type, ' ') AS c_type, "
  50. + " NVL(way.dept_sx3, ' ') AS dept_sx3, "
  51. + " NVL(way.manager_name, ' ') AS manager_name "
  52. + " from qd_para_wayinfo way where regexp_like(way.c_wayid,'QD[0-9]{6}') and way.si_waystate = 1 ";
  53. System.out.println("sql......"+sql);
  54. try {
  55. ps = oraConn.prepareStatement(sql);
  56. rs = ps.executeQuery();
  57. while (rs.next()) {
  58. if ("".equals(rs.getString("vc_acctname").trim())) {
  59. msg = msg + "银行帐户名为空,";
  60. }
  61. if ("".equals(rs.getString("vc_acctbank").trim())) {
  62. msg = msg + "开户银行为空,";
  63. }
  64. if ("".equals(rs.getString("vc_wayacctno").trim())) {
  65. msg = msg + "银行帐号为空,";
  66. }
  67. if ("".equals(rs.getString("dept_sx1").trim())) {
  68. msg = msg + "渠道属性为空,";
  69. }
  70. if ("".equals(rs.getString("c_accttype").trim())) {
  71. msg = msg + "帐户类型为空,";
  72. }
  73. if (rs.getInt("si_chain") == -9) {
  74. msg = msg + "店铺属性为空,";
  75. }
  76. if (rs.getInt("si_chain") == 3
  77. && "".equals(rs.getString("c_type").trim())) {
  78. msg = msg + "连锁属性为空,";
  79. }if("".equals(rs.getString("c_wayid").trim())) {
  80. msg = msg + "渠道编号为空";
  81. }
  82. if ("".equals(rs.getString("dept_sx3").trim())) {
  83. msg = msg + "星级为空";
  84. }
  85. if (!"".equals(msg)) {
  86. msgs = msgs + rs.getString("manager_name") + "|"
  87. + rs.getString("c_wayid") + "|" + msg+"|";
  88. }
  89. msg = "";
  90. }
  91. } catch (Exception e) {
  92. e.printStackTrace();
  93. }finally{
  94. if(rs !=null){rs.close();}
  95. if(ps !=null){ps.close();}
  96. }
  97. return msgs;
  98. }
  99. /**
  100. * 插入公告表 qd_anno_myAnnouncement
  101. * @throws SQLException
  102. * */
  103. private boolean insertMyAnnouncement(long sender,Date send_time,String title,Clob cb) throws SQLException{
  104. boolean flag = false;
  105. PreparedStatement psInsert = null;
  106. SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  107. try {
  108. String sql =
  109. "insert into qd_anno_myannouncement(id, sender , send_time , title , content ) " +
  110. "select qd_anno_myannouncement_seq.nextval,? , ? , ? ,? from dual ";
  111. psInsert = oraConn.prepareStatement(sql);
  112. psInsert.setLong(1, sender);
  113. psInsert.setTimestamp(2, Timestamp.valueOf(sf.format(send_time)));
  114. psInsert.setString(3, title);
  115. psInsert.setClob(4, cb);
  116. int num = psInsert.executeUpdate();
  117. if(num > 0){
  118. flag = true;
  119. }
  120. oraConn.commit();
  121. } catch (Exception e) {
  122. e.printStackTrace();
  123. oraConn.rollback();
  124. }finally{
  125. if(psInsert !=null){psInsert.close();}
  126. }
  127. return flag;
  128. }

 

以上就是JDBC 操作插入表出现javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB的详细内容,更多关于JDBC 操作插入表出现javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB的资料请关注九品源码其它相关文章!