'DriverManager.getConnection() with JDBC SQLite hangs on some PCs

I have a user who repeatedly has the problem that the call to DriverManager.getConnection() often gets stuck but after a while it might work normally.

My code for opening the database connection is:

String className = JDBC.class.getName();
Class.forName(className);
String connectionString = JDBC.PREFIX + databaseFilePath;

For every other user this works fine, though. I did not find any related topics on this besides here but it's not exactly the same issue.

I already added the Class.forName(className) call to register the JDBC driver since I thought it might help but it seemingly isn't necessary anymore to open a database connection.

I'm using the latest version sqlite-jdbc-3.28.0.jar provided by

<dependency>
    <groupId>org.xerial</groupId>
    <artifactId>sqlite-jdbc</artifactId>
    <version>3.28.0</version>
</dependency>

I did not try another database implementation but I tried to set a login timeout using setLoginTimeout(10).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source