Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class configurasion {
- public TextField Puerto;
- public TextField base;
- public TextField servidor;
- public String CONEXION_STRING = "jdbc:mysql://127.0.0.1:3306/proyecto";
- public String USUARIO = "root";
- public String PASSWORD = "";
- private static Connection conexion;
- public void configurasion(MouseEvent mouseEvent) {
- abrirConexion();
- }
- public static Connection getConexion() {
- return conexion;
- }
- private void abrirConexion() {
- try {
- conexion = DriverManager.getConnection(CONEXION_STRING, USUARIO, PASSWORD);
- } catch (SQLException e) {
- JOptionPane.showMessageDialog(null, "La conexion no se realizo exitosamente: " + e.getMessage());
- }
- JOptionPane.showMessageDialog(null, "Conexion a base de datos exitosa ");
- }
- public void atras(MouseEvent mouseEvent) {
- try {
- Parent root = FXMLLoader.load(getClass().getResource("../Vistas/ingresarDatos.fxml"));
- Scene scene = new Scene(root);
- Stage anterior = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
- anterior.setScene(scene);
- anterior.show();
- } catch (IOException ex) {
- Logger.getLogger(configurasion.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
Add Comment
Please, Sign In to add comment