My problem is very simple. When I try to drop a table by doing DROP TABLE SCCM; using UCanAccess, I get these error messages :
Caused by: java.sql.SQLException: java.sql.SQLSyntaxErrorException: dependent objects exist: PUBLIC."DOUBLONS SCCM POSTE" in statement [DROP TABLE SCCM ]
Caused by: java.sql.SQLSyntaxErrorException: dependent objects exist: PUBLIC."DOUBLONS SCCM POSTE" in statement [DROP TABLE SCCM ]
Caused by: org.hsqldb.HsqlException: dependent objects exist: PUBLIC."DOUBLONS SCCM POSTE"
I understand that this happens because "something" need "something else" so the table cannot be dropped however, I have no idea what are those "things".
Also something else, when I try to execute the drop command directly into Access, I don't have that dependant objet error.
Is there a way to force drop a table or something like that ?
Edit : added code snippets
This is how I execute my DROP query
Connection connection = Access.getConnection();
Statement statement = connection.createStatement();
System.out.println("DROP TABLE " + this.name + " ;");
statement.execute("DROP TABLE " + this.name + " ;");
And this is how I get my connection
public class Access {
private final String urlTemplate = "jdbc:ucanaccess://redacted/req.accdb";
private static Connection connection;
private Access() throws SQLException {
connection = DriverManager.getConnection(urlTemplate);
}
public static Connection getConnection() throws SQLException {
if (connection == null) {
new Access();
}
return connection;
}
}
(Also; I know it would have been better to use PreparedStatement but in my case, it is not possible)