SESSION in EJB is obtained

xiaoxiao2021-03-14  197

/ ** * set of data objects configured tColManage * @param rs * @return Collection * @throws SQLException * / protected Collection getColManages (KRMDS ds, String strSQL) throws SQLException {log.log (Level.INFO, strSQL); Connection conn = NULL; preparedStatement Pstat = null; ResultSet RS = NULL; try {conn = ds.getConnection (); pstat = conn.preparestatement (strsql);

Log.log (Level.info, "Start Query ..."); rs = pstat.executeQuery (); arraylist array = new arraylist (); managecolinui vo = null; arraylist arraylist = null; int i = 0; while (WHILE {i ; if ((math.rint (i / maxcols)) * maxCols) == 1) {ArrayList = new arraylist (); vo = new managecolinui (); vol = new managecolinui (); vol = new management ArrayList); Array.Add (VO); ArrayList.Add (GetManageinui (RS));} // Turn RS, PStat Rs.Close (); pstat.close (); conn.close (); return array;} Catch (SQLEXCEPTION E) {Try {// if (conn! = null) conn.close ();} catch (sqlexception ex) {} // throw e;} finally {Try {// IF (conn! = null ); Conn = null; pstat = NULL; RS = null;} catch (sqlexce e) {// throw e;}} Return NULL;} / ** * Close a ResultSet , avoid closing if null and hide * any sqlexceptions That {TRY {Close (RS);} catch (sqlexception sqle) {// quiet}}

. / ** * Close a Statement , avoid closing if null and hide * any SQLExceptions that occur * / public static void closeQuietly (Statement stmt) {try {close (stmt);} catch (SQLException sqle ) {// quiet}} / ** * Close a resultset , Avoid Closing if Null and hide * any sqlexceptions there {Try {close (RS) {Try {Close } Catch (SQLException SQLE) {// quiet}}

. / ** * Close a Statement , avoid closing if null and hide * any SQLExceptions that occur * / public static void closeQuietly (Statement stmt) {try {close (stmt);} catch (SQLException sqle ) {// quiet}}}

转载请注明原文地址:https://www.9cbs.com/read-129462.html

New Post(0)