Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.7.1
-
None
-
Windows 10, CentOS 7
Description
Hi,
I am using the MariaDB ConnectorJ to connect to a database. Since I had several nasty problems in the past, I created some tests with JUnit to test the database connection.
Since many versions of Connector/J this test fails, no exception is thrown (sorry, had no time to report it earlier):
@Test |
public void constructorClosedConnection() throws SQLException { |
assertThrows(SQLException.class, () -> { |
Connection closedConnection = Database.getInstance().getConnection();
|
closedConnection.rollback();
|
closedConnection.close();
|
 |
closedConnection.prepareStatement("SELECT * FROM SampleTable"); |
});
|
}
|
The function Database.getInstance().getConnection() grabs a connection from the connection-pool and returns it. This issue is not important in production, but every time I run my tests this test fails, while it worked in the past.