-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FilePathDisk.newDirectoryStream() may fail on remote drive on Windows due to AccessDeniedException in Path.toRealPath() #3486
Comments
If H2 is launched on 32-bit Windows or in 64-bit JVM on 64-bit Windows, you need to check access permissions of If H2 is launched in 32-bit JVM on 64-bit Windows, you need to check access permissions of Some anti-virus software also may prevent write access to these directories for regular applications, Program Files is usually a bad place to store your data. |
Thanks for response. My actual folder is on Shared drive S:\h2store_2\nt folder. |
New versions of H2 use NIO.2 API (introduced in Java 7) to work with files, old versions use old API from Java 1.0. These APIs may be implemented with different system functions on Windows, so hypothetically something may work in different way with them. Do you have a complete stack trace? |
Remote directories (drives) aren't really suitable for database files, they have various issues. You can try to add |
2022-04-19 03:51:18 database: opening S:/myfolders/var/global/wx/h2Stores_2/nt/nt-h2-store |
i m using below connection url- |
The cause of this issue is unusual. But, again, it is a bad idea to use remote directories (drives) for database files. |
You can also try to write a some simple test case (with I found a similar bug, but in your case exception is different: |
Thank you for suggestions. I had tried POC around toRealPath() and find out that this method requires access for each folder and drives in order to run without any issues. so have to give permission to S:/ drive, plus all of the folders in my path. |
Does |
i tried same my POC with toAbsolutePath() and it works fine. It returns me the path of folder. |
Hi Katzyn, is below commit contains changes from H2 v1.4 to H2 v2.1.210 ? [h2/src/main/org/h2/store/fs/FilePathDisk.java] - line no. 200 - newDirectoryStream()(2b159d1#diff-e26da4e5126a84ed38b1b9d09b77712ed127b3f5f6e3a316074fde68950bb213) |
I tried to handle the error in my local & it seems resolved my issue. Below is my change: machineh2\h2database\h2\src\main\org\h2\store\fs\disk\FilePathDisk.java--- Below is the function in which i have commented one line and replace it with "return Collections.emptyList();" @OverRide Please let me know if this is the correct way to handle this error ? can we make this change ? |
No, it isn't correct. We need these files anyway. |
If you can compile H2 from its current sources, please re-test this issue in your environment. Building instructions are here: |
Thanks Katzyn..!!! :-) |
i have verified the updated jar and its working as expected. |
Any ETA when we are going to release this fix in new version ? |
No description provided.
The text was updated successfully, but these errors were encountered: