mrAsacura
3 years ago
2 changed files with 27 additions and 2 deletions
@ -1,19 +1,44 @@
@@ -1,19 +1,44 @@
|
||||
package ru.egspt.moodle; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
|
||||
public class Access { |
||||
private static String userName = "esoe"; |
||||
private static String password = "psalm6912"; |
||||
private static String userName; |
||||
private static String password; |
||||
private static String url = "jdbc:MySQL://45.128.206.87:3306/moodle"; |
||||
|
||||
//если значение userName отсутствует, запросить его у пользователя
|
||||
public static String getUserName(){ |
||||
setUserName(); |
||||
return userName; |
||||
} |
||||
public static String getPassword(){ |
||||
setPassword(); |
||||
return password; |
||||
} |
||||
public static String getURL(){ |
||||
setUrl(); |
||||
return url; |
||||
} |
||||
/** |
||||
* @param userName the userName to set |
||||
*/ |
||||
public static void setUserName() { |
||||
Access.userName = JOptionPane.showInputDialog("Укажите имя пользователя базы данных:"); |
||||
} |
||||
/** |
||||
* @param password the password to set |
||||
*/ |
||||
public static void setPassword() { |
||||
Access.password = JOptionPane.showInputDialog("Укажите пароль пользователя базы данных:"); |
||||
} |
||||
/** |
||||
* @param url the url to set |
||||
*/ |
||||
public static void setUrl() { |
||||
String u = JOptionPane.showInputDialog("Укажите url базы данных:"); |
||||
Access.url = "jdbc:MySQL://" + u + ":3306/moodle"; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
Binary file not shown.
Loading…
Reference in new issue