0

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?

Saqib Ali
  • 3,953
  • 10
  • 55
  • 100
user10512791
  • 63
  • 1
  • 13

1 Answers1

1

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.

Jerod Johnson
  • 764
  • 7
  • 15
  • Exception in thread "main" XcoreXexcelX190X7052.xtb: System error: \\xx.xx.xx.xxx\ExcelRemote\products.xlsx (The user name or password is incorrect), where can i give username and password? – user10512791 Jun 20 '19 at 06:46
  • The error message you're seeing looks like a Windows authentication error. Does the Windows account running the Java application have explicit access to the remote location? – Jerod Johnson Jun 20 '19 at 14:20
  • i have actually opened shared drive and tried with my code it worked fine but without connecting to the drive tried to connect from code i get above exception. How can i solve this? @Jerod Johnson – user10512791 Jun 21 '19 at 08:29