0

I am trying to manipulate a MS Access database with java without ODBC and I've tried following the instructions over at Manipulating an Access database from Java without ODBC but I keep on getting the error:

Error connecting net.ucanaccess.jdbc.UcanaccessSQLException: user lacks privilege or object not found: EMPLOYEE

I have already added the necessary JAR files to the library so I believe that something is wrong with my code or database. I am fairly new to databases and running Java SE 8 and using the NetBeans IDE 8.0.

The code is below

package javaapplication1;

import java.sql.*;

public class Dbase {

    public static void main(String[] args) {
        try {

            Connection c = DriverManager.getConnection(
                    "jdbc:ucanaccess://C:/Users/nevik/Desktop/databaseJava/Employee.accdb");
            Statement s = c.createStatement();
            ResultSet resSet = s.executeQuery("SELECT [FNAME] FROM [Employee]");
            while (resSet.next()) {
                System.out.println(resSet.getString(1));
            }
        } 
          catch (SQLException sqle) {
            System.err.println("Error connecting " + sqle);
        }
    }
}
Community
  • 1
  • 1
guevarak12
  • 75
  • 1
  • 5
  • 14
  • Double-check the name of your table in the database. Are you sure the table is named [Employee], not [Employees] or some other variant spelling? – Gord Thompson Jun 18 '14 at 13:21
  • Thank you! The name of the table was called Table1 the name of the file was employee.accdb. – guevarak12 Jun 18 '14 at 13:55

0 Answers0