Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Problem in Accessing MS Access 2010 using UCanAccess Library (https://www.askmehelpdesk.com/showthread.php?t=812163)

  • May 25, 2015, 12:42 AM
    isoumya2010
    Problem in Accessing MS Access 2010 using UCanAccess Library
    Hi -

    I am trying to write a java program to Query a MS Access File (2010). The file is connected to a Share Point Site. I am using UCanAccess libraries to get it done. Following is the code snippet I am trying to run...

    String fileName = "D:/UcanAccess/sample.accde";
    try {
    // Class.forName("net.ucanaccess.jdbc.Ucanaccess Driver");
    con = DriverManager.getConnection("jdbc:ucanaccess://" + fileName + ";memory=false");
    st = con.createStatement();
    rs = st.executeQuery("SELECT DISTINCTROW Opportunity.* FROM Opportunity WHERE (((Opportunity.Global_Ops)=True))");
    int counter = 0;
    while (rs.next()) {
    counter++;
    }
    System.out.println("Total Records Count: " + counter);
    } catch (SQLException e) {
    e.printStackTrace();
    }

    White running the code, instead of getting windows authentiation pop-up window, I am getting following error...

    WARNING:External file D:\UcanAccess\http:\sharepoint_site_url\sites\0152 76;LIST=UserInfo;VIEW=;RetrieveIds=Yes does not exist
    WARNING:given file does not exist: http:\sharepoint_site_url\sites\015276;LIST=UserIn fo;VIEW=;RetrieveIds=Yes
    net.ucanaccess.jdbc.UcanaccessSQLException: user lacks privilege or object not found: OPPORTUNITY
    at net.ucanaccess.jdbc.UcanaccessStatement.executeQue ry(UcanaccessStatement.java:202)
    at TestUcanAccess.main(TestUcanAccess.java:25)
    Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: OPPORTUNITY

    I tried to get it done using Jdbc-Odbc Driver and it worked perfectly in JDK1.7 but in JDK1.8 it did not work as Jdbc-Odbc driver has been removed from JDK1.8 environment. That's why I am opting for UCanAccess Libraries.

    So, Please help me out to resolve the exact issue I am having.

    Please note, If I remove share point site reference, the above mentioned code is working fine.

    Please Help. Thanks in Advance for any sort of Help.

  • All times are GMT -7. The time now is 04:19 AM.