简书链接:JDBCforSqlserversetBinaryStream方法提示抽象方法问题
文章字数:75,阅读全文大约需要1分钟
在实现类中JtdsPreparedStatement我调用的方法并没有实现,直接抛出异常,所以调用int方法可以解决此问题。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

@Override
public void setBinaryStream(int parameterIndex, InputStream x)
throws SQLException {
// TODO Auto-generated method stub
throw new AbstractMethodError();
}

/* (non-Javadoc)
* @see java.sql.PreparedStatement#setBinaryStream(int, java.io.InputStream, long)
*/
@Override
public void setBinaryStream(int parameterIndex, InputStream x, long length)
throws SQLException {
// TODO Auto-generated method stub
throw new AbstractMethodError();
}
1
2
3
4
5
6
7
8
9
10
11
12
@Override
public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException {
checkOpen();

if (x == null || length < 0) {
setBytes(parameterIndex, null);
} else {
setParameter(parameterIndex, x, java.sql.Types.LONGVARBINARY, 0, length);
}
}