javasqlms-accessjdbcucanaccess

How to access MS Access queries (not normal tables) using Java?


I am having trouble getting data from a query in MS Access using UcanAcess library in java.

In Access you can create normal tables - getting data from there is no problem. You can also create a "query", that means you create a table by using informations from different tables.

Still, when using the same code and just changing the name of the table, I get following error, which means he can not find it or I am not allowed to access (it is probably about not finding it):

UCAExc:::4.0.4 user lacks privilege or object not found: ALLE OE RG ABFRAGE

Here is the method I am using:

Connection conn= DriverManager.getConnection("jdbc:ucanaccess://C:/Users/B070252/Desktop/KopieAuswertungen.accdb"); //AuswertungenZBAV
    Statement s = conn.createStatement();
    ResultSet rs = s.executeQuery("SELECT * FROM [ALLE OE RG ABFRAGE]");
    while (rs.next()) {
        System.out.println(rs.getString(2));
    }
    return null;

Note: I am using UcanAccess, but the trouble is not with the library. I am thankful for every tip or solution and hope you can help me.


Solution

  • Brother, I copied the data from the query and pasted it in a normal table. I can read the normal table now