I am developping an app for Windows by myself and have issues with it since it is my first time. My environment is Windows 11 and my terminal uses Visual Studio environment vcvars64. I package my app with the commands gradle clean jlink --info and gradle jpackage -PinstallerType=msi.
My code for accessing the database is the following :
public ConnectionDB() {
try {
System.out.print("Connecting to the database... ");
this.co = DriverManager.getConnection(DB_CONN_URL, DB_USER, DB_PASSWD);
System.out.println("Connected");
} catch (SQLException e) {
System.err.println("Failed");
e.printStackTrace(System.err);
}
}
public Connection getCo() {
return co;
}
public void close() {
try {
// Fermeture de la connection
System.out.print("Disconnecting from the database... ");
this.co.close();
System.out.println("disconnected");
} catch (SQLException e) {
System.err.println("failed");
e.printStackTrace(System.err);
}
}
public ResultSet executeQuery(String query) {
// System.out.println(query);
try {
Statement statement = co.createStatement();
ResultSet result = statement.executeQuery(query);
return result;
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
System.out.println(e.getErrorCode());
}
return null;
}
When launching from my terminal I encounter no error but when I launch the .exe, my calls to my remote database crash for some of them, notably the inserts. When debugging the process running the database connection with Visual Studio, I encounter the following error with each access demand to my remote database : Exception thrown at 0x000001FE3BCBF1B1 in CharacterCreator.exe: 0xC0000005: Access violation reading location 0x0000000000000008
.
I have made my researchs but cannot find a clue on what to do to correct this or even dig further into the issue.
Would you happen to have valuable information?