/** * Create the composite. * * @param parent * @param style */ public OracleLoginComposite( Composite parent, int style, List<String> listGroupName, String selGroupName, UserDBDAO userDB) { super(DBDefine.ORACLE_DEFAULT, parent, style, listGroupName, selGroupName, userDB); setText(DBDefine.ORACLE_DEFAULT.getDBToString()); }
@Override public boolean connection() { if (!isValidate()) return false; String dbUrl = ""; if (comboConnType.getText().equals("SID")) { dbUrl = String.format( DBDefine.ORACLE_DEFAULT.getDB_URL_INFO(), textHost.getText(), textPort.getText(), textDatabase.getText()); } else if (comboConnType.getText().equals("Service Name")) { dbUrl = String.format( "jdbc:oracle:thin:@%s:%s/%s", textHost.getText(), textPort.getText(), textDatabase.getText()); } userDB = new UserDBDAO(); userDB.setTypes(DBDefine.ORACLE_DEFAULT.getDBToString()); userDB.setUrl(dbUrl); userDB.setDb(textDatabase.getText()); userDB.setGroup_name(comboGroup.getText().trim()); userDB.setDisplay_name(textDisplayName.getText()); userDB.setOperation_type( DBOperationType.getNameToType(comboOperationType.getText()).toString()); userDB.setHost(textHost.getText()); userDB.setPasswd(textPassword.getText()); userDB.setPort(textPort.getText()); // userDB.setLocale(comboLocale.getText().trim()); userDB.setUsers(textUser.getText()); // 기존 데이터 업데이트 if (oldUserDB != null) { if (!MessageDialog.openConfirm(null, "Confirm", Messages.SQLiteLoginComposite_13)) return false; //$NON-NLS-1$ if (!checkDatabase(userDB)) return false; try { TadpoleSystem_UserDBQuery.updateUserDB(userDB, oldUserDB, SessionManager.getSeq()); } catch (Exception e) { logger.error(Messages.SQLiteLoginComposite_8, e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.SQLiteLoginComposite_5, errStatus); // $NON-NLS-1$ return false; } // 신규 데이터 저장. } else { // db가 정상적인지 채크해본다 try { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB); List showTables = sqlClient.queryForList("tableList", textDatabase.getText()); } catch (Exception e) { logger.error(Messages.OracleLoginComposite_7, e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.OracleLoginComposite_10, errStatus); // $NON-NLS-1$ return false; } try { TadpoleSystem_UserDBQuery.newUserDB(userDB, SessionManager.getSeq()); } catch (Exception e) { logger.error("Oracle db info save", e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.OracleLoginComposite_11, errStatus); // $NON-NLS-1$ } } return true; }