wise-coders / dbf-jdbc-driver

DBF & FoxPro JDBC Driver | DbSchema DBF Designer
https://dbschema.com/databases/dbf-management-gui.html
Other
23 stars 15 forks source link

java.nio.file.NoSuchFileException #7

Closed trueMiskin closed 5 months ago

trueMiskin commented 1 year ago

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?

wise-coders commented 1 year ago

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")
trueMiskin commented 5 months ago

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.

wise-coders commented 5 months ago

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