/// <summary> /// DB 접속 /// </summary> /// <returns>접속 수행 결과</returns> public bool TestOpenDB(ConfigDBData dbInfo) { bool result = false; try { // 내부적으로 생성/연결된 컨넥션이 내부 멤버 오브젝트를 Dispose로 삭제해도 // 실시간으로 삭제되지 않아 컨넥션이 계속해서 남아있는 문제가 있음. // 그래서 상위에서 매번 new 해서 새로운 오브젝트를 생성해야할 필요가 있다. this.oracleDB = new AdengOracleDbEx(); this.oracleDB.OpenOracle(dbInfo.HostIP, dbInfo.ServiceID, dbInfo.UserID, dbInfo.UserPassword); result = this.oracleDB.IsOpen; } catch (Exception ex) { System.Console.WriteLine("[DBConnector] TestOpenDB( " + ex.ToString() + " )"); FileLogManager.GetInstance().WriteLog("[DBConnector] TestOpenDB ( Exception=[" + ex.ToString() + "] )"); return(false); } finally { if (this.oracleDB.IsOpen) { this.oracleDB.Close(); } this.oracleDB = null; } return(result); }
/// <summary> /// DB 접속 /// </summary> /// <returns>접속 수행 결과</returns> public bool OpenDB() { bool isOpen = false; try { // 내부적으로 생성/연결된 컨넥션이 내부 멤버 오브젝트를 Dispose로 삭제해도 // 실시간으로 삭제되지 않아 컨넥션이 계속해서 남아있는 문제가 있음. // 그래서 상위에서 매번 new 해서 새로운 오브젝트를 생성해야할 필요가 있다. this.oracleDB = new AdengOracleDbEx(); this.oracleDB.OpenOracle(this.targetHostIP, this.targetSID, this.targetUserID, this.targetUserPWD); isOpen = this.oracleDB.IsOpen; } catch (Exception ex) { System.Console.WriteLine("[DBConnector] OpenDB( " + ex.ToString() + " )"); FileLogManager.GetInstance().WriteLog("[DBConnector] OpenDB ( Exception=[" + ex.ToString() + "] )"); isOpen = false; if (this.oracleDB.IsOpen) { this.oracleDB.Close(); } this.oracleDB = null; } return(isOpen); }
/// <summary> /// DB 접속 종료 /// </summary> public void CloseDB() { try { this.oracleDB.Close(); } catch (Exception ex) { System.Console.WriteLine("[DBConnector] CloseDB( " + ex.ToString() + " )"); FileLogManager.GetInstance().WriteLog("[DBConnector] CloseDB ( Exception=[" + ex.ToString() + "] )"); } finally { if (this.oracleDB.IsOpen) { this.oracleDB.Close(); } this.oracleDB = null; } }