Search code examples
exceljdbccdata-drivers

How to connect to a remote file using CData Excel JDBC driver?


Using CData to connect to local excel file with jdbc url below:

Connection conn = DriverManager.getConnection("jdbc:excel:Excel File=C:\MyExcelWorkbooks\SampleWorkbook.xlsx;");

Can we connect to a remote file using CData, If so what can be the connection jdbc url?


Solution

  • The CData JDBC Driver for Excel is designed to connect to local and network-accessible files. For example, to connect to an Excel file that has been shared on another machine, use a connection string similar to the following:

    jdbc:excel:Excel File=\\SHARED_MACHINE\SharedFolder\SharedFile.xlsx
    

    If the Excel file is NOT accessible to the machine on which the driver was installed, (i.e. only accessible from Remote Desktop) then the CData JDBC Driver will not be able to connect to it.