Hello.
I am using HXTT excel driver to get data from an excel file. File is in shared folder which asks username and password to access it's files. When I try to connect to it by HXTT driver after accessing folder by file explorer it connects successfully but when I try to connect, providing username and password, which I use to connect in file explorer it throws exception
java.sql.SQLException: \SharedFolder\HXTT\data.xlsx doesn't exist or can't be accessed. If you're using mapped drives to access database files, you may need to check the security permissions.
How can I solve this authentication issue?
|
jdbc:excel:smb://[[[domain;]username[:password]@]server[:port]/[[share/[dir/]file]]][?[param=value]]
|
It's at http://www.hxtt.com/excel/advanced.html#mining .
|
Thank you for your quick response!
|
I have one more question and I can't find any solution for it. I successfully connect and read my excel file from machine by this way, providing username password for machine. But for those cases that excel file is in the folder which also requires username password, so I have to specify 2 credentials I can't find a way to connect to it. Is there any solution for this case?
|
For instance,
jdbc:excel:smb://[[[domain;]username[:password]@]server[:port]/share/dir/[?[param=value]]
Then
select * from your excelfiles.sheetName .
|
That is the way I connect to the machine and select from public file of it, this works fine.
My problem is when file is in the secured folder. To be more clear lets say machine name is MCH1 I connect to it by "machineUser" and "machinePassword" credential, and I have one shared folder in it - "securedfolder" which I connect by "folderUser", "folderPassword" credential.
I have successfully read from public file by this URL - jdbc:excel:smb://machineUser:machinePassword@MCH1/path/publicFolder/HXTT/Data.xlsx?maxScanRows=31
But for sequired folder I try like this
jdbc:excel:smb://machineUser:machinePassword@MCH1/path/securedfolder/HXTT/Data.xlsx?maxScanRows=31
and it throws exception - Failed to load database Data:jcifs.smb.SmbException: The network name cannot be found.
I guess It's because I nowhere provide "folderUser" and "folderPassword" so it can't get excel file from it. Is there any solution for this situation?
|
>and I have one shared folder in it - "securedfolder" which I connect by "folderUser", "folderPassword" credential.
Because your securedfolder is used different credential to share, you have to
use
jdbc:excel:smb://folderUser:folderPassword@MCH1/path/securedfolder/HXTT/Data.xlsx?maxScanRows=31
to access it.
|