Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE
This series introduces you to a step-by-step process for developing Java (or JFC) based applications with Microsoft SQL Server as the database, using NetBeans IDE. In this article (which is the last in this series), I shall introduce you to traversing through a set of rows more efficiently. This will be a bit different from any of the articles in this series.
Traversing To and Fro with SQL Server Based Java Applications using NetBeans IDE - How to handle the clear memory resources when the form is closed (Page 5 of 5 )
This is a special scenario we need to implement. This sort of situation never occurred in any of our previous applications. When the form was opened, we immediately started connecting to the database and retrieving information. When the form is closed, we need to close our connections and release other memory resources.
In this case, we need to trap the event of something like "window closing." This can be achieved from the following:
Right click on the frame (during design time) and go to properties.
By default it shows "properties;" switch to "events."
Within the "events," select "windowClosing" and click on the "ellipsis" button.
Once you see the "handlers" dialog, click "Add" and give the "New Handler name" as "WhenWindowClosing."
Once you complete the above steps, the screen will look something like this (Fig03).
Another way to develop such applications is by using JDO (Java Data Objects). I shall cover those topics in the future. But I would like to conclude the series at this point and open a new series in the near future.
Remarks
The entire code for this article is freely available in the form of a zip file. That downloadable solution was developed using NetBeans 4.1 IDE and tested with Microsoft SQL Server 2000 database Enterprise Edition (with Service Pack 3) together with Microsoft Windows 2003 Standard Edition. I didn't really test it in any other version or platform. Please follow the respective platform documentation to get it working.
The final issue you need to know is that none of my articles in this series are optimized for performance. Tuning/improving the performance of Java applications is beyond the scope of this article. I simply wanted to explain the concepts a bit more clearly.
Any doubts, bugs, errors, suggestions, feedback etc. are highly appreciated at jag_chat@yahoo.com.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.