How to make Java work with SQL Server?

前端 未结 9 1436
别那么骄傲
别那么骄傲 2020-12-13 06:23

I know this is a basic question, but I can\'t seem to find an answer and I apologize, if this question is way too stupid, but here we go:

I am supposed to work with

9条回答
  •  一向
    一向 (楼主)
    2020-12-13 07:09

    If you are use sqljdbc4.jar, use the following code

    ResultSet objResultSet = objPreparedStatement.getResultSet();
    if (objResultSet == null) {
      boolean bResult = false;
      while (!bResult){
        if (objPreparedStatement.getMoreResults()){
          objResultSet = objPreparedStatement.getResultSet();
          bResult = true;
        }
      } 
    }
    objCachedRowSet = new CachedRowSetImpl();
    objCachedRowSet.populate(objResultSet);
    if (CommonUtility.isValidObject(objResultSet)) objResultSet.close();
    objResultSet = null;
    

提交回复
热议问题