Bug #96105 Load data local infile doesn't resolve ~ as home directory
Submitted: 5 Jul 2019 10:23 Modified: 24 Nov 11:35
Reporter: Dmitriy Tseyler Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:8.0.15, 8.0.16 OS:Any
Assigned to: CPU Architecture:Any

[5 Jul 2019 10:23] Dmitriy Tseyler
Description:
MySQL Connector/J doesn't resolve paths with tilde char, but should

How to repeat:
1. Write a simple command like:

LOAD DATA LOCAL INFILE '~/Documents/some_file.txt'
INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
IGNORE 1 LINES;

2. Execute

Expected:
File successfully uploaded to a database

Actual:
...FileNotFoundException...

Suggested fix:
Replace tilde char in the path with System.getProperty("user.home")
[5 Jul 2019 13:11] MySQL Verification Team
Hello Dmitriy,

Thank you for the report.

regards,
Umesh
[24 Nov 11:35] Alexander Soklakov
Posted by developer:
 
Though the tilde means the user's home directory in some shells it's not a valid file path that can be used in the APIs.
JDK does not take it as a file path, see https://bugs.openjdk.java.net/browse/JDK-8152072 for example. So, Connector/J will not try to do it as well.