This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Sometimes, when a connection is closed from within the explorer, it looks like it is closed, but the engine still has a connection. This can cause data corruption with embedded databases. To test this, one needs a reliable way to check that a connection is still open. With an embedded database, for instance, it is usually sufficient to attempt to delete the database files, which should always be possible after the DB explorer closes its connection. I can't make a testcase because it is not 100% reproducible.
It appears to be almost 100% reproducible now. I have already lost data a couple of times because with this there is no way of disconnecting from the database at all. For an embedded database that is a high risk operation, comparable with pulling the plug of a machine that runs a database server. There is definitely a leak in netbeans somewhere. Why is this "future"? It can't be good for netbeans to leave this as it is.
Cannot reproduce with dev build. There was a similar issue #25770 but it was fixed a long time ago. I added debug message to org.netbeans.modules.db.explorer.infos.ConnectionNodeInfo.disconnect() method. When the connection was closed by java.sql.Connection.close() method I tested it with java.sql.Connection.isClosed() method and I got always true. It meant that the connection was closed from the JDBC API point of view. If you are sure that the connection is still open it is probably a driver issue. For QA: Martine, could you try to reproduce it, please?
Radko, Thanks for investigating this. You are probably quite correct in that the conection that you are focusing on is closed properly. But how do you know that not accidentally other connections are opened and not closed? My way of reproducing this is as follows, and I would suggest to use this or a similar method to reproduce the error: - Connect to QED with Netbeans - Expand the tables node in the DB explorer to view the list of tables - Disconnect with the DB explorer - After this don't change anything in netbeanse, i.e. leave it running - Try to open a connection the the same QED database from another Java program. This fails in most cases and only closing netbeans gets around that problem. Then, additionally, perform this test in the other direction: - Close Netbeans - Connect to QED with the other Java program. - Disconnect from QED from the other Java program. - Connect to QED with netBeans. This has never failed so far.
Let me try to provide more information. It appears that success in deleting the qed database directory is no longer a criterion for failure. One needs another application to open a connection. I reproduced the error once again on Windows 98 this morning: In netbeans: - I connect with a user name, but without password - I check "Remember password during this session" - I connect as generic database system (I realise the buttons on the dialog don't respond to mouse clicks - So I use keyboard shortcuts) - I right click on the connection icon and select "Disconnect" - I delete the database directory in Windows Explorer (this did not work when I first reported the bug but it works now) - I restore the database directory from the recycle bin by pressing ctrl-z in Windows explorer - I start an application in netbeans that opens a connection to this database. The error is: 2003-10-16 09:53:47.030: [main] java.io.IOException: lockfile already exists. Maybe another process is accessing the database? at com.quadcap.sql.file.Datafile.init(Datafile.java:390) at com.quadcap.sql.Database.init(Database.java:121) at com.quadcap.jdbc.JdbcDriver.connect(JdbcDriver.java:225) So the deleting of the database directory is no longer helpful to verify this bug. One needs another java application that connects to the same database.
Created attachment 11877 [details] This class fails to connect to the database after it is closed in Netbeans
I tried to reproduce the problem by both ways which you described. It worked for me without any problem, no exception was thrown, the connection was always established. Could you try it with my yesterday's changes, please? Download dev build from Oct 16 (#200310160100) or later from http://www.netbeans.org/downloads/ide/development.html and I hope it will work for you.
Great. It works flawlessly in the latest development build. Radko, you probably know best what fixed it. I just mark this as worksforme. Thanks again for your help.
I would mark it FIXED...
marking as FIXED
as Bernard comfirmed this bug is fixed, just verifying