java.sql.SQLException: 违反协议: [12]

阅读更多
表名:V_WJW_IPT_ADMISSIONNOTE
表结构:
java.sql.SQLException: 违反协议: [12]_第1张图片

由于项目测试需要,需要将表[V_WJW_IPT_ADMISSIONNOTE]中的字段jilunr进行批量修改,编写测试代码如下:
	@Test
	public void update_jilunr() throws ClassNotFoundException, SQLException, IOException {

		Connection conn = getConnection(ResourceBundle.getBundle("jdbc/jdbc"));
		String xml = FileUtils.readFileToString(new File("target/1.xml"), "GBK");

		String sql = "UPDATE V_WJW_IPT_ADMISSIONNOTE SET jilunr=? ";

		PreparedStatement ps = conn.prepareStatement(sql);

		ps.setString(1, xml);

		ps.executeUpdate();

		ps.close();
		conn.close();

	}

执行后报错,如下:
java.sql.SQLException: 违反协议: [12]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:464)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3665)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1352)
at demo.oracle.UpdateDemo.update_jilunr(UpdateDemo.java:49)
...


折腾了半天,仍不知问题在哪,无意间我修改了SQL语句,如下:
		String sql = "UPDATE V_WJW_IPT_ADMISSIONNOTE SET jilunr=? WHERE JZLSH='ZY240889'";

再次执行,则修改通过!
o(︶︿︶)o 唉,看来[LONG]型大字段字段的修改是不能批量修改啊!
  • java.sql.SQLException: 违反协议: [12]_第2张图片
  • 大小: 6.2 KB
  • 查看图片附件

你可能感兴趣的:(oracle,违反协议,LONG,批量)