1
我想讀一些屬性通過以下命令MSSQL和JDBC讀DBCC USEROPTIONS
DBCC USEROPTIONS
如何在JDBC使用下面的命令返回?
List<ResultVO> list = getJdbcTemplate().query(sql, new ParameterizedBeanPropertyRowMapper<ResultVO>() {
@Override
public ResultVO mapRow(ResultSet rs, int rowNumber) throws SQLException {
System.out.println(rowNumber);
ResultVO v = new ResultVO();
v.setSetOption(rs.getString(0));
v.setValue(rs.getString(1));
//--
return v;
}
}, (List<String>) null);
它拋出異常如下:
Caused by: org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT DBCC USEROPTIONS]; The index 1 is out of range.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is out of range.
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:106)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)