internal string RestoreDB(string URL, string BackupPath,string DBFolder) { string DBName = URL.Replace("http://", string.Empty); DBName = DBName.Replace(":", "Port"); DBName = DBName + ".fdb"; string DBPath = string.Format("{0}\\{1}", DBFolder,DBName); ConnectionVO cvo = new ConnectionVO(URL,DBPath); WebService.ServerMain.getInstance().RestoreDB(BackupPath,cvo); return DBPath; }
internal void AddDBConnection(ConnectionVO connVO) { //잘못된 URL형식 걸러내기 if (!(connVO.ServiceURL.Contains("http://")) || (connVO.ServiceURL.Replace("http://", string.Empty).Length == 0)) { return; } try { IDBService DBModel = new PostgresSQLDBServicecs(connVO); ConnDic.Add(connVO.ServiceURL, DBModel); ActiveDBKeyList.Add(connVO.ServiceURL); } catch (Exception ex) { LogController.getInstance().WriteLogFile(ex.Message); } }
internal void DropDB(ConnectionVO connVO) { try { //db가 존재하는지 검증 IDBService ds = new PostgresSQLDBServicecs(connVO); ds.Dispose(); } catch (Exception) { return; //DB가 없는 경우는 그냥 나간다 } try { //DB에 연결되어 있는 경우는 연결 종료한다 ConnDic[connVO.ServiceURL].Dispose(); } catch (Exception) { } PostgresSQLDBServicecs.DropDB(connVO); }
public DBService(ConnectionVO connVO, string HostURL) { try { NpgsqlConnectionStringBuilder nsb = new NpgsqlConnectionStringBuilder(); nsb.Host = HostURL; nsb.Port = 5432; nsb.SSL = false; nsb.IntegratedSecurity = false; nsb.UserName = "******"; nsb.Database = connVO.DataBaseName; nsb.Password = connVO.DBPassword; NpgConn = new NpgsqlConnection(nsb.ToString()); NpgConn.Open(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 웹서비스를 상황에 맞게 세팅 /// </summary> /// <param name="CommonSettingsVO"> /// 공통설정정보VO /// 없으면 null입력 /// </param> /// <param name="serviceURLDic"> /// 서비스 정보 리스트 /// key: url value:DBPath /// 없으면 null 입력 /// </param> private void SetWebService(CommonSettingsVO CommonSettingsVO, IDictionary <string, string> serviceURLDic) { if (CommonSettingsVO == null) { //[1]공통설정정보가 없는 경우의 예외처리 WebServiceManager = null; MessageBox.Show("서비스를 시작하지 못했습니다. 먼저 서버설정을 하여 주십시오"); return; } else if (serviceURLDic == null || serviceURLDic.Count == 0) { //[2]서비스 정보 목록이 없는경우 예외처리 WebServiceManager = new WebServiceManager(CommonSettingsVO); if (!WebServiceManager.ServerReady) { WebServiceManager.ServerOn(rdSecurityMode.Checked); } } else { //[3] 정상적인 경우의 처리 WebServiceManager = new WebServiceManager(CommonSettingsVO); if (!WebServiceManager.ServerReady) { bool UseSecurity = false; if (CommonSettingsVO.MessageCredentialType != MessageCredentialType.None) { UseSecurity = true; } WebServiceManager.ServerOn(UseSecurity); } IList <ConnectionVO> connList = new List <ConnectionVO>(); //웹서비스 Param foreach (string url in serviceURLDic.Keys) { ConnectionVO cvo = new ConnectionVO(url, serviceURLDic[url]); connList.Add(cvo); } WebServiceManager.AddService(connList); } }
public static void CreateDB(ConnectionVO connVO) { try { //[1] postgresSQL설치여부 검증 if (!new DBEngineModel().CheckServerEngine()) { throw new Exception("PostgresSQL서버가 설치되어 있지 않습니다. 프로그램을 다시 시작하여 주십시오"); } //[2] postgresSQL설치된 경로 가져오기 string createdbPath = string.Format("{0}/createdb.exe", new DBEngineModel().GetPostSQLUtillPath()); //[3] postgresSQL설치된 경로에서 createdb.exe 실행해서 DB생성 string createdb_args = string.Format("-h 127.0.0.1 -p {0} -U {1} -O {1} -E {2} {3}", connVO.port, connVO.DBID, connVO.Charset, connVO.DataBaseName); new FileExecuter().Exec(createdbPath, createdb_args); } catch (Exception ex) { throw ex; } }
public PostgresSQLDBServicecs(ConnectionVO connVO) { try { this.myConnVO = connVO; NpgsqlConnectionStringBuilder nsb = new NpgsqlConnectionStringBuilder(); nsb.Host = connVO.HostURL; nsb.Port = 5432; nsb.SSL = false; nsb.IntegratedSecurity = false; nsb.UserName = connVO.DBID; nsb.Database = connVO.DataBaseName; nsb.Password = connVO.DBPassword; nsb.Pooling = false; NpgConn = new NpgsqlConnection(nsb.ToString()); NpgConn.Open(); } catch (Exception ex) { throw ex; } }
public void AddService(ConnectionVO connVO) { if (!this.ServerReady) { throw new Exception("서버가 준비되지 않았습니다"); } //중복된 URL골라내기 bool isDuplicate = false; IDictionary <string, bool> serviceDic = WebServiceServer.ServerMain.getInstance().ActiveServiceDic; ICollection <string> urlList = serviceDic.Keys; foreach (string url in urlList) { if (connVO.ServiceURL == url) { isDuplicate = true; break; } } if (!isDuplicate) { ServerConsole.AddService(connVO); } }
internal static void RestoreDB(string BackupFilePath, ConnectionVO connVO, bool makeNewDB) { PostgresSQLDBServicecs.Restore(BackupFilePath, connVO, makeNewDB); }
public void DropDB(ConnectionVO connVO) { DBController.getInstance().DropDB(connVO); }
public void CreateDB(ConnectionVO connVO) { // DBController.CreateDB(connVO); }
public void RestoreDB(string BackupFilePath, ConnectionVO connVO, bool makeNewDB) { DBController.RestoreDB(BackupFilePath, connVO, makeNewDB); }
public void AddService(ConnectionVO connVO) { this.ServiceConnController.AddServiceURL(connVO.ServiceURL); dbConn.AddDBConnection(connVO); CheckServices(); }
internal static void RestoreDB(string BackupFilePath, ConnectionVO connVO) { // DBService.Restore(connVO.DataBasePath, BackupFilePath,connVO.DBID,connVO.DBPassword); }
private void AddDB(ConnectionVO connVO) { }
public void CreateDB(ConnectionVO connVO) { DBController.getInstance().CreateDB(connVO); }
public void RestoreDB(string BackupFilePath, ConnectionVO connVO) { DBController.RestoreDB(BackupFilePath, connVO); }