Greetings!
I tested using ucanaccess in Lucee (Tomcat-based CFML engine). I can successfully access table objects and run queries as long as I join real tables in Access. However when I try to run a saved query named xyz within Access's "queries" tab, I get the error:
UCAExc:::4.0.4 user lacks privilege or object not found: XYZ. This error implies that the driver cannot access query objects directly as in sql "Select * from XYZ". I was able to do so in the past using ODBC. Is this a feature not implemented yet within the driver or am I doing something wrong? I am using (Access 2007 -20016 file format) - accdb.
Any insight would be greatly appreciated.
Sincerely
Hasan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
UCanAccess certainly can work with saved SELECT queries as you've described, with some limitations. Try opening the .accdb file using console.bat (or console.sh) and see if it gives you any indication of why the saved query "xyz" is not being loaded, e.g.,
Thank you Gord for your prompt response!
I did run Console.bat as you prescribed, I got the same error "user lacks privilege or object not found: XYZ", but this time the Console debug messages revealed more helpful info. As I mentioned earlier, XYZ is a saved query, but what I failed to mention is that XYZ joins 2 "Linked" tables, not local tables. Those 2 linked tables are linked to 2 csv files. When I run XYZ from within Access I get results just fine.
The Console showed that it "loaded" a third local table but not the 2 linked tables which XYZ uses. That gave me the impression that may be the driver does not handle linked tables as local tables. So to test this assumption, I converted the 2 linked tables to local tables and ran the XYZ query internally within Access, and it ran successfully. I ran the Console.abt again and it showed that it loaded the 2 converted files, but the saved XYZ was not loaded, and gave me the same error of "User lacks privilege or object not found:XYZ". So I am back where I started.
Below is output of the running Console.bat. Note that XYZ is the same as DistinctFullJoin query. I used XYZ term as a short for DistinctFullJoin for the purpose of reporting this issue
FROM sales LEFT JOIN deliveries ON (sales.[Sold To] = deliveries.[Sold To ]) AND (sales.Line = deliveries.Line) AND (sales.[Sales Order] = deliveries.[Sales Order])
WHERE sales.[Sold To] = (SELECT value from Config where key='CustomerCode')
FROM sales RIGHT JOIN deliveries ON (sales.[Sold To] = deliveries.[Sold To ]) AND (sales.Line = deliveries.Line) AND (sales.[Sales Order] = deliveries.[Sales Order])
WHERE deliveries.[Sold To] = (SELECT value from Config where key='CustomerCode')
) AS x;
The above query runs just fine within Access.
Much obliged,
Hasan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Gord. I think I narrowed the issue down to Linked tables vs. Local tables. I managed to rewrite my saved query and got it to run from Lucee. However it worked only when the saved query joined Local tables. When the tables were Linked the saved query could not be run via the driver and gave the usual error of "User lacks privilege..etc".
For future releases of Ucanaccess, would it be possible to "Load" Linked tables by the driver and be treated similarly as Local tables?
Best regards
Hasan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Hasan. UCanAccess can work with persistent linked tables that point to physical Access tables in a different .accdb/.mdb file. What it cannot currently do is work with linked tables that point to
Excel workbooks,
.csv/.txt files, or
ODBC data sources
Handling those kinds of linked tables is on our wish list, but we have no ETA on when that might happen.
Last edit: Gord Thompson 2018-09-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey @gordonthompson, was this feature ever added to UCanAccess to read ODBC Linked tables directly via driver?
I am trying to connect to a legacy system which only support ODBC via Java. Since there is no longer a direct ODBC support for Java, I was doing a work around to link the ODVC source to MS Access via a live link and read using MS Access. I stumbled upon the issue that UCanAccess is limited to reading linked tables.
Also if this is not on roadmap, can you recommend if there is a way to refresh ODBC data daily in MS Access if I create static tables instead of Linking.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got a similar problem. In the website says that ucanaccess supports running I am trying to run a saved query in Access but got the same error "User lacks privilege or object not found". All tables used in query are local to the database file. Can ucanAccess use saved queries or not? if so how? in the sourceforge page it says "You can execute Select queries defined and saved in Access." Can you show me how to do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Greetings!
I tested using ucanaccess in Lucee (Tomcat-based CFML engine). I can successfully access table objects and run queries as long as I join real tables in Access. However when I try to run a saved query named xyz within Access's "queries" tab, I get the error:
UCAExc:::4.0.4 user lacks privilege or object not found: XYZ. This error implies that the driver cannot access query objects directly as in sql "Select * from XYZ". I was able to do so in the past using ODBC. Is this a feature not implemented yet within the driver or am I doing something wrong? I am using (Access 2007 -20016 file format) - accdb.
Any insight would be greatly appreciated.
Sincerely
Hasan
UCanAccess certainly can work with saved SELECT queries as you've described, with some limitations. Try opening the .accdb file using
console.bat
(orconsole.sh
) and see if it gives you any indication of why the saved query "xyz" is not being loaded, e.g.,Thank you Gord for your prompt response!
I did run Console.bat as you prescribed, I got the same error "user lacks privilege or object not found: XYZ", but this time the Console debug messages revealed more helpful info. As I mentioned earlier, XYZ is a saved query, but what I failed to mention is that XYZ joins 2 "Linked" tables, not local tables. Those 2 linked tables are linked to 2 csv files. When I run XYZ from within Access I get results just fine.
The Console showed that it "loaded" a third local table but not the 2 linked tables which XYZ uses. That gave me the impression that may be the driver does not handle linked tables as local tables. So to test this assumption, I converted the 2 linked tables to local tables and ran the XYZ query internally within Access, and it ran successfully. I ran the Console.abt again and it showed that it loaded the 2 converted files, but the saved XYZ was not loaded, and gave me the same error of "User lacks privilege or object not found:XYZ". So I am back where I started.
Below is output of the running Console.bat. Note that XYZ is the same as DistinctFullJoin query. I used XYZ term as a short for DistinctFullJoin for the purpose of reporting this issue
The saved query xyz (i.e. DistinctFullJoin) is below...
SELECT DISTINCT x.*
FROM (SELECT sales.[Product Category], sales.[Sold To], sales.[Sold To Customer], sales.[Ship To Customer], sales.[Purchase Order Number], sales.[SO Entered], sales.[PO Date], sales.[Sales Order], sales.Line, sales.[Material Number], sales.[Material Description], sales.[Order Qty], sales.[Shipped Qty], sales.[Remaining Qty], sales.[Confirmed Qty], sales.[Scheduled Ship Date],
deliveries.[Ship Qty], deliveries.[Ship Date], deliveries.Invoice, deliveries.[POD Status], deliveries.[Outbound Delivery], DateAdd("d",14,sales.[Scheduled Ship Date]) AS EstimatedSampleCompletionDate, sales.[Net Value]
FROM sales LEFT JOIN deliveries ON (sales.[Sold To] = deliveries.[Sold To ]) AND (sales.Line = deliveries.Line) AND (sales.[Sales Order] = deliveries.[Sales Order])
WHERE sales.[Sold To] = (SELECT value from Config where key='CustomerCode')
UNION ALL
SELECT sales.[Product Category], deliveries.[Sold To], deliveries.[Sold To Customer], deliveries.[Ship To Customer], deliveries.[Purchase Order Number], deliveries.[SO Entered], deliveries.[PO Date], deliveries.[Sales Order], deliveries.Line, deliveries.[Material Number], deliveries.[Material Description], deliveries.[Order Qty], sales.[Shipped Qty], deliveries.[Remaining Qty], sales.[Confirmed Qty], deliveries.[Scheduled Ship Date], deliveries.[Ship Qty], deliveries.[Ship Date], deliveries.Invoice, deliveries.[POD Status], deliveries.[Outbound Delivery], DateAdd("d",14,deliveries.[Ship Date]) AS EstimatedSampleCompletionDate, deliveries.[Net Value]
FROM sales RIGHT JOIN deliveries ON (sales.[Sold To] = deliveries.[Sold To ]) AND (sales.Line = deliveries.Line) AND (sales.[Sales Order] = deliveries.[Sales Order])
WHERE deliveries.[Sold To] = (SELECT value from Config where key='CustomerCode')
) AS x;
The above query runs just fine within Access.
Much obliged,
Hasan
Hi Gord. I think I narrowed the issue down to Linked tables vs. Local tables. I managed to rewrite my saved query and got it to run from Lucee. However it worked only when the saved query joined Local tables. When the tables were Linked the saved query could not be run via the driver and gave the usual error of "User lacks privilege..etc".
For future releases of Ucanaccess, would it be possible to "Load" Linked tables by the driver and be treated similarly as Local tables?
Best regards
Hasan
Hi Hasan. UCanAccess can work with persistent linked tables that point to physical Access tables in a different .accdb/.mdb file. What it cannot currently do is work with linked tables that point to
Handling those kinds of linked tables is on our wish list, but we have no ETA on when that might happen.
Last edit: Gord Thompson 2018-09-19
Thank you Gord! This explains the issue for me. I will be looking forward to the enhancements in future releases.
Best regards,
Hasan
Hey @gordonthompson, was this feature ever added to UCanAccess to read ODBC Linked tables directly via driver?
I am trying to connect to a legacy system which only support ODBC via Java. Since there is no longer a direct ODBC support for Java, I was doing a work around to link the ODVC source to MS Access via a live link and read using MS Access. I stumbled upon the issue that UCanAccess is limited to reading linked tables.
Also if this is not on roadmap, can you recommend if there is a way to refresh ODBC data daily in MS Access if I create static tables instead of Linking.
I got a similar problem. In the website says that ucanaccess supports running I am trying to run a saved query in Access but got the same error "User lacks privilege or object not found". All tables used in query are local to the database file. Can ucanAccess use saved queries or not? if so how? in the sourceforge page it says "You can execute Select queries defined and saved in Access." Can you show me how to do this?