Menu

Windows Distributed File System (DFS)

Help
2017-05-23
2017-05-23
  • Dan Drendall

    Dan Drendall - 2017-05-23

    I've been trying to connect to an Access DB file (*.accdb) from a platform built on Java. I've uploaded the driver files and all the jar files to what I believe to be the correct location in this platform's file structure. I can access the file if I copy it from across the network to my local machine, but when I try to access the file out on the network from that same machine, it attempts to connect, but fails to find the file which throws the following exceptions:

    "Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 given file does not exist: \xxx\dfs\operations\Capacity.accdb
    Caused by: java.io.FileNotFoundException: given file does not exist:
    \xxx\dfs\operations\Capacity.accdb

    I have the drive mapped to my local machine as O:\ (Win 7). As I understand it, Win Server 2012 uses dfs to spread files around on different servers to conserve space, etc. Does anyone have any experience with the same problem? Thanks.

    I've tried a number of different iterations in the connect string, but have not been able to get it to connect.

    Wondering about authentication, syntax, and whether the dfs is messing with the namespace too much.

    Best,
    Dan

     
  • Dan Drendall

    Dan Drendall - 2017-05-24

    I've tried all three of these connection URL's in multiple iterations (slash variations, including "dfs" in the path or not, including the drive letter or not) when the UNC path did not connect:


    3) Create a connection using the following JDBC Connection URL examples:
    Windows local path:
    jdbc:ucanaccess://C:/Users/Public/Database1.accdb;showSchema=true
    Windows UNC path: jdbc:ucanaccess:////servername/sharename/foldername/Database1.accdb;showSchema=true
    Linux/unix: jdbc:ucanaccess:///home/gord/Documents/Database1.accdb;showSchema=true

     
  • Marco Amadei

    Marco Amadei - 2017-05-24

    Just to be clear Dan,
    and because it's one of most frequent questions... if you can access via java to that path, it works. If not, it doesn't. This isn't UCanAccess related.
    In other words, if you do

    File fl=new File(<whatever path used>);//e.g. C:/Users/Public/Database1.accdb
    System.out.println(fl.exists());
    

    you get the answer.
    And you can redirect yourself to the right forums for help.
    Cheers Marco

     

    Last edit: Marco Amadei 2017-05-24
  • Dan Drendall

    Dan Drendall - 2017-05-24

    That's very helpful Marco. Thank you for the pointer.
    I'm using a java platform that uses Jython as its scripting lanquage. Perhaps I'll do some testing along those lines.

    If I find anything revealing, I'll try to remember to post back for posterity.

    It does seem like it could be a permissions or authority issue.

    Best, Dan

     
  • Dan Drendall

    Dan Drendall - 2017-06-05

    Thanks for this clue Gord. I have tried restarting while following the guidelines above, and made some inquiry into my registry, and paths don't appear to be corrupt.

    I'm working within a platform that uses Jython as its scripting language, so I've brought some Python tools to bear on the problem and was able to get a different response/exception to an attempt to connnect to the file over dfs, to wit:


    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'net.ucanaccess.jdbc.UcanaccessDriver' for connect URL 'jdbc:ucanaccess:\\mcv\dfs\operations\capacity.accdb;showSchema=true'
    Caused by: java.sql.SQLException: No suitable driver


    In Python I did a:

    import os
    os.path.abspath('//servername/dfs/drivename/filename.accdb')
    

    and the interpreter returned:

    '\\\\servername\\dfs\\drivename\\filename.accdb'
    

    So I proceeded to plug that string into the jdbc:ucanaccess: URL as indicated in the exception above, and it appears I've hung up the driver somehow. Still not clear if the driver kicks off properly if I would still receive a file not found exception as before, so it's hard to know whether this is "progress" on its face. Any further sleuthing tips are much appreciated when anyone gets a moment. Thanks.

    Best,
    Dan

     

    Last edit: Dan Drendall 2017-06-05
    • Gord Thompson

      Gord Thompson - 2017-06-05

      re: "no suitable driver" - The connection must begin with jdbc:ucanaccess:// and then the path to the database file. For UNC path \\server\share\folder\file.accdb that would be

      jdbc:ucanaccess:////server/share/folder/file.accdb
      
       
  • Dan Drendall

    Dan Drendall - 2017-06-05

    To be clear regarding the UNC path vs a DFS alias, according to the registry, I'm using the UNC path which involves "./dfs/." in the path at least from my desktop's perspective that's the case. If this is the alias, and there is a UNC path then my IT person is not aware of it, and our IT service that we outsource our servers to has not been forthcoming re: this config internal to their system.

     
  • Dan Drendall

    Dan Drendall - 2017-06-05

    If it helps, I can do the following Python command from within the Java platform with repeatable success:

    >>> shutil.copyfile('\\\\servername\dfs\drivename\filename.accdb','C:\Capacity.accdb')
    

    So I can access the db file via file utilities internally from my java platform.

     
  • Gord Thompson

    Gord Thompson - 2017-06-06

    If possible, please run the following Java test code and let us know what you get.

    package dfsTest;
    
    import java.io.File;
    import java.io.RandomAccessFile;
    
    public class DfsTestMain {
    
        public static void main(String[] args) {
            // https://sourceforge.net/p/ucanaccess/discussion/help/thread/759c9ccb/
    
            String dfsPath = "//mcv/dfs/operations/capacity.accdb";
            try {
                System.out.println("Creating File object ...");
                File f = new File(dfsPath);
                System.out.println("  " + f.getAbsolutePath());
                System.out.println("Creating read-only RandomAccessFile object ...");
                RandomAccessFile rafR = new RandomAccessFile(dfsPath, "r");
                System.out.println("  OK");
                rafR.close();
                System.out.println("Creating read-write RandomAccessFile object ...");
                RandomAccessFile rafRW = new RandomAccessFile(dfsPath, "rw");
                System.out.println("  OK");
                rafRW.close();
            } catch (Exception e) {
                e.printStackTrace(System.err);
            }
        }
    
    }
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.