0
I need to access the ACCESS database, the query is accessing correctly, but I noticed that to have the return of information, the JAVA first reads and all the tables and all the data, is that right? does not have a way to perform the query only what is requested?
DAO class:
// File name
String filename = "\\\\arquivo.mdb";
String url = "jdbc:ucanaccess://" + filename.trim();
// Realiza a conexão com o banco de dados
String usuario = "";
String senha = "";
conexao = DriverManager.getConnection(url, usuario, senha);
return conexao;
the Consultation:
PreparedStatement ps = connection.prepareStatement("SELECT * FROM ATENDIMENTO");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
System.out.println(rs.getString("DATA"));
System.out.println(rs.getString("CLIENTE"));
}
thanks for the feedback, I always do this, however as I am just testing, I gave a select *. The problem I noticed is that it is reading the entire database to then load the information, and that’s what I’m questioning, that’s right even?
– HimorriveL
I get it, it’s a slowness that occurs before you even select. This answer in English explains the reason and gives a way to solve it. I will translate it soon.
– Piovezan
Translation made.
– Piovezan