4
Staff I developed a web application whose database is MS Access, well, when the user logs in I send the data by ajax to the java class to do the login and password validation, the problem is that when the system will connect in the database my connection class gives the following error "java.sql.Sqlexception: No suitable driver found for jdbc:ucanaccess://banco_data softTech.accdb" Until then ok is not finding a driver, but I decided to do a test and created a method "public Static void main" in my connection class, and called the same login validation method, the class was as follows:
public static Connection conectar() {
Connection conexao = null;
try {
conexao = DriverManager.getConnection("jdbc:ucanaccess://banco_dados\\softTech.accdb");
} catch (Exception e) {
System.out.println("Erro na conexão com o banco " + e.toString());
}
return conexao;
}
public static void main(String[] args) {
try {
Funcionario f = new Funcionario();
f.setLoginFuncionario("TESTE");
f.setSenhaFuncionario("TESTE");
String resultado = new FuncionarioDAO().validaLogin(f);
System.out.println(resultado);
} catch (Exception e) {
System.out.println(e.toString());
}
}
When running this class it is that the thing gets strange, because the connection is done normally, I do not know what might be going on need help
The mistake is this:
java.sql.Sqlexception: No suitable driver found for jdbc:ucanaccess://src/banco_data/softTech.accdb
but as I said the driver was entered yes, and when I test direct by the class it gives no error at all.
Hello Falion, taking a closer look at the error message I realized the following excerpt " net.ucanaccess.jdbc.Ucanaccesssqlexception: Given file does not exist: banco_dados softTech.accdb" or by the way my application is not finding my access file, this means either I’m putting the file in the wrong place within the project (if that’s where it would be ideal to put ?), or else I’m writing the path wrong (if that’s how it should be then ?), thanks in advance !
– user3628479
Hello friend, try to write the whole way to the . accdb, example : 'jdbc:ucanaccess://c://Folder/softTech.accdb' this can correct your error, because usually Java consists of giving errors of this type because there is no correct path to the location.
– Falion
If I helped you, :)
– Falion
For example, did you use the DSN for the connection? whenever there is MS in the move has to use more than one path to the file create an alias for the file and export together in the duplicate/installation. always solves ....
– user3873165