ResultSet

 

1、留着自己以後查看的:

                   DataSource dataSource = null;
		Connection connection = null;
		ResultSet rs = null;
		dataSource = (DataSource) BeanFactoryUtil.getBean("fibre");
		connection = dataSource.getConnection();
		Statement st = connection.createStatement(
				ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
		try {
			//System.out.print(sql);
			rs = st.executeQuery(sql);
			CachedRowSet rowset = createCachedRowset();
			rowset.populate(rs);
			rs.close();
			return rowset;
		} catch (SQLException ex) {
			Logger.getLogger(this.getClass().getName()).log(Level.ERROR, null,
					ex);
			return null;
		} finally {
			if (st != null) {
				st.close();
			}
			if (connection != null) {
				connection.close();
			}
		}

發佈了27 篇原創文章 · 獲贊 1 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章