General Information
Windows 10 Home Edition , Java 8 Update 121
Description
I have an simple Java program that renames Files and Folders
.
As I read from different articles Maximum filename length is generally 255 for modern versions on operating Systems , like Linux, Windows, Mac Os. So I keep it maximum of 240 just in case.
Maximum filename length in NTFS (Windows XP and Windows Vista)?
https://serverfault.com/questions/9546/filename-length-limits-on-linux
Test cases
So I have a Folder in the path C://GOXR3PLUS//..//Folder
which contains a very simple sqlite3 database File named dbFile.fb
.
Case 1 ❌
I rename the Folder
to Folder
plus 203 characters , so the folder name is Folderrrrrr....
until 207 characters. Trying to connect to the sqlite3 database I get this exception:
SEVERE:
java.sql.SQLException: The database has been closed
at org.sqlite.core.NativeDB.throwex(NativeDB.java:471)
at org.sqlite.core.NativeDB.errmsg_utf8(Native Method)
at org.sqlite.core.NativeDB.errmsg(NativeDB.java:137)
at org.sqlite.core.DB.newSQLException(DB.java:921)
at org.sqlite.core.DB.throwex(DB.java:886)
at org.sqlite.core.NativeDB._open_utf8(Native Method)
at org.sqlite.core.NativeDB._open(NativeDB.java:71)
at org.sqlite.core.DB.open(DB.java:174)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:220)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:26)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at org.sqlite.JDBC.connect(JDBC.java:88)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at database.DbManager.<init>(DbManager.java:149)
at application.Main.lambda$8(Main.java:508)
at java.lang.Thread.run(Thread.java:745)
Case 2 ✅
I rename the Folder
to Folder
plus 196 characters so the folder name is Folderrrrrr....
until 201 characters. No exception occurs trying to open the sqlite3 database.
Finally
I am trying to open the dbFile.db
with notepad for the first case , and it opens. Eclipse reports file not found , and with the Java application I am getting the error i posted .
My Question is:
Why does this happen, even though I am not even passing 210 characters for Folder Name?