chequer-io / JDBC.NET

It is a wrapper that allows you to use JDBC drivers in ADO.NET
MIT License
34 stars 10 forks source link

JdbcConnection.CloseAsync() issue #34

Open TinaRadenkovic opened 11 months ago

TinaRadenkovic commented 11 months ago

During the opening of the connection using JdbcConnection.OpenAsync() method with correct DriverPath and DriverClass but an incorrect JdbcUrl, the driver starts, and the connection status becomes Broken. However, when attempting to close this connection, the driver remains active and requires manual shutdown. The problem lies in the JdbcConnection.CloseAsync() method, which only sets the connection status to Closed. The JdbcBridgePool.Release(Bridge.Key) is not executed due to a condition in the if statement where ConnectionId is null. Should this be fixed in future updates?

smilinger commented 10 months ago

Also, the ConnectionId should be set to null after the connection is closed, otherwise if the subsequent connection fails, it will try to close the broken connection, which will throw an exception that says:

Cannot invoke "java.sql.Connection.close()" because "connection" is null