Greetings, I don't know why the connection doesn't run, will it be because jackcess
it will be obsolete or because of the version of my jdk 1.8? because I already added JAR
UCanAccess
4.0.4 to the libraries through netbeans
package Frames;
import java.sql.*;
import javax.swing.*;
import java.sql.DriverManager;
/**
*
* @author
*/
// creando la clase conexion para conectar a la base de datos en Access
public class Conexion {
static Connection conn = null;
static String driver = "net.ucanaccess.jdbc.UcanaccessDriver";
static String url = "jdbc:ucanaccess://C:\\xxxx\\xxx.accdb";
public static Connection ejecutarConexion(){
try{
if(conn==null){
Class.forName(driver);
conn = DriverManager.getConnection(url);
JOptionPane.showMessageDialog(null, "Conectado");
}
} catch (Exception ex){
ex.printStackTrace();
conn = null;
}
return conn;
}
public static void main(String [] args){
Connection cn= Conexion.ejecutarConexion();
}
}
The error is the following:
The error is in the
driver
you are using this:Try this one, it worked for me
And you are missing
createStatement
but I leave you this example of my connection class to give you an idea of the parts that you were missing