Reputation: 11
import java.sql.*;
class Test{
public static void main(String ar[]) {
try {
//String url="jdbc:odbc:logingdsn";
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection c=DriverManager.getConnection("jdbc:ucanaccess://C:\\Users\\aCER\\Desktop\\login.laccdb");
Statement st=c.createStatement();
ResultSet rs=st.executeQuery("select * from logintable");
while(rs.next()){
System.out.println(rs.getString(1));
}
} catch (Exception ee) {
System.out.println(ee);
}
}
}
I'm using UCanAccess jar file for ms access db connectivity in jdk1.8/jre/lib/ext ...
I have included all required jar files but I'm still getting this exception
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.x.x Unsupported newer version: 32
and its not loading driver class. What's wrong?
Upvotes: 1
Views: 947
Reputation: 123399
The .laccdb
file does not contain the database objects (tables, views, etc.). It is a lock file that the Access Database Engine uses to manage connections to the main database file, which is the .accdb
file.
So, your connection URL should point to the .accdb
file, not the .laccdb
file.
Upvotes: 2