0
I don’t know what happened that now the connection to the database is taking too long. Before I was quick to give the answer if it was connected or not... now it takes about 15 minutes and my pc doesn’t work right gets everything mainly locking the eclipse...
Now any project gives this "bug"... I wonder where I’m going wrong?
The connector I’m using is this, I’ve tried the current also gave in the same... mysql-Connector-java-5.0.8-bin-jar
package br.com.Sistema.dal;
import java.sql.*;
public class ModuloConexao {
//metodo por estabelecer conexao com o banco
public static Connection conector() {
java.sql.Connection conexao = null;
// linha abaixo "chama" o driver
String driver = "com.mysql.jdbc.Driver";
// armazenando informaçoes referente ao bd
String url = "jdbc:mysql://localhost:3306/teste";
String user = "root";
String pass = "vertrigo";
// Estabecendo conexao ao Banco de Dados
try {
Class.forName(driver);
conexao = DriverManager.getConnection(url, user, pass);
System.out.println(conexao);
return conexao;
} catch (Exception e) {
// a linha abaixo serve de apoio para esclarecer o erro
//JOptionPane.showMessageDialog(null,"Não há Conexao com o Banco de Dados");
return null;
}
}
}
Login screen
package TelaPrincipal.telas;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.sql.*;
import br.com.Sistema.dal.ModuloConexao;
public class TelaLogin extends javax.swing.JFrame {
Connection conexao = null;
PreparedStatement pst = null;
ResultSet rs = null;
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
TelaLogin frame = new TelaLogin();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public TelaLogin() {
conexao = ModuloConexao.conector();
System.out.println(conexao);
setResizable(false);
setTitle(" < Sistema de Usuario >");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 330, 191);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblUsurio = new JLabel("Usuario");
lblUsurio.setHorizontalAlignment(SwingConstants.RIGHT);
lblUsurio.setFont(new Font("Tahoma", Font.BOLD, 12));
lblUsurio.setBounds(8, 17, 62, 26);
contentPane.add(lblUsurio);
JLabel lblSenha = new JLabel("Senha");
lblSenha.setHorizontalAlignment(SwingConstants.RIGHT);
lblSenha.setFont(new Font("Tahoma", Font.BOLD, 12));
lblSenha.setBounds(20, 54, 50, 26);
contentPane.add(lblSenha);
textField = new JTextField();
textField.setBounds(92, 21, 176, 20);
contentPane.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(92, 52, 176, 20);
contentPane.add(textField_1);
JLabel lblConectado = new JLabel("");
lblConectado.setIcon(new ImageIcon("C:\\ambiente_de_trabalho\\teste\\Inbras\\src\\br\\com\\inbras\\icones\\desconectado1.png"));
lblConectado.setBounds(30, 91, 33, 33);
contentPane.add(lblConectado);
JButton btnLogin = new JButton("Login");
btnLogin.setBounds(92, 101, 176, 23);
contentPane.add(btnLogin);
}
}
The code is working, only hangs at the time of connection to bank... I gave up my server, which is the vertrigo, installed again, did not work. I’ve installed Xampp too, didn’t work anyway...
Whatever is causing this error?
How is the use of RAM, HD and processing of your machine? It may simply be that some process external to Eclipse is using too many resources, or else that your RAM is full and the operating system is paging on disk the working memory
– Jefferson Quesado
my hd has 930 Gb free space 635gb. memory in use(compressed) 3,5gb available 4,3 Gb
– joao paulo oliveira
People with a lot of suffering find out what it was. I downloaded an application from banco santander, Plug in G-Buster....
– joao paulo oliveira
deleted if plugin and returned to normal..
– joao paulo oliveira