dbf-jdbc-driver icon indicating copy to clipboard operation
dbf-jdbc-driver copied to clipboard

java.nio.file.NoSuchFileException

Open trueMiskin opened this issue 2 years ago • 1 comments

Hi, in the JDBC constructor, the library tries to open the log file, but the \.DbSchema\logs path does not exist.

java.nio.file.NoSuchFileException: C:\Users\<User>\.DbSchema\logs\DbfJdbcDriver.log.lck
 	at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
 	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
 	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
 	at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(Unknown Source)
 	at java.nio.channels.FileChannel.open(Unknown Source)
 	at java.nio.channels.FileChannel.open(Unknown Source)
 	at java.util.logging.FileHandler.openFiles(Unknown Source)
 	at java.util.logging.FileHandler.<init>(Unknown Source)
 	at com.wisecoders.dbschema.dbf.JdbcDriver.<clinit>(JdbcDriver.java:44)

Is it even right to create own log if the application using this library has own log?

trueMiskin avatar Feb 26 '23 15:02 trueMiskin

We use in our code

final FileHandler fileHandler = new FileHandler("%h/.DbSchema/logs/DbfJdbcDriver.log");
            fileHandler.setFormatter( new SimpleFormatter());
            fileHandler.setLevel(Level.ALL);
            LOGGER.addHandler(fileHandler);

the %h should be replaced by the home directory. See FileHandler

Could you please check, maybe is a issue with the home directory on your computer? If you test this using DbSchema, you can print the user.home from the SQL Editor, by switching to Groovy and using

println System.getProperty("user.home")

dbschema-pro avatar Mar 15 '23 11:03 dbschema-pro

Hi,

problem is not in the incorrect path. The folders .DbSchema\logs do not exist in the home directory.

You are only creating folders for H2_LOCATION.

trueMiskin avatar Jun 03 '24 17:06 trueMiskin

Thank you for your reply. This is correct. We added a fix for this issue.

dbschema-pro avatar Jun 03 '24 19:06 dbschema-pro