SQL Editor and NetBeans | #1

In the previous blog, I mentioned SQL Editor. NetBeans has improved it in every release in the past 2 years and it looks great these days. Here’s a sneak-peek;

Click to enlarge!

This figure shows the SQL Editor window along with the results shown for the command executed, written in the editor (select * from nbusers). Also, you can see numerous toolbar buttons, and results are shown in similar way as if it was any CRUD application. We will discuss this in more detail in following section and follow-up blogs.

Key Features..

Execute Command

To execute any SQL query within the NetBeans IDE, you must write the necessary queries in the SQL Editor shown above. Then, you may use a shortcut key (Ctrl-Shift-E) or make use of the icon (Run SQL (Ctrl+Shift+E)), clicking this toolbar button will execute the queries against the selected database (shown in drop-down list of Connection‘s), and relevant feedback is generated in the Output window (see figure). Also, results are shown as mentioned earlier.

Click to enlarge!

SQL History

Now, we will have a look at another cool feature, known as SQL History. You can read more about it on some of the Sun blogs written by;

John Baker

A new database feature in NetBeans 6.5 is the ability to save and reuse SQL statements that have been executed. A dialog listing SQL statements along with the date executed can be opened from the SQL Editor by right-clicking within the editor and choosing SQL History or clicking an image button for SQL History in the SQL Editor toolbar.

James Branam

The order the statements appears in is descending, the more recently executed statement appears at the top of the dialog. To help search for an SQL statement, you can choose the connection for the database against which the statement was executed.

Here’s a quick view of the feature;

Click to enlarge!

Integration with Database Explorer

This is also one of the coolest features about SQL Editor, i.e. its integrated with Database Explorer shown in Services window, goto “Window | Services” or hit the shortcut keys (Ctrl+5) on Windows Operating System to access the window.

Click to enlarge!

This figure shows Database Explorer on the left, while the SQL Editor on the right and Output window at the bottom of the two. Here you could see database (created for demonstration) named prayogshala is connected on MySQL Server running on localhost. It has only one table named nbusers, which consists of attributes (username, firstname, lastname).

Blast from the Past,

I google’d a bit about the presence of NetBeans SQL Editor on Sun blogosphere and I was amazed to find a blog which dates back to Year 2005, when SQL Editor was first introduced into the NetBeans IDE. It was none other than, Geertjan Wielenga who blogged about it…

One area that’s improved significantly in NetBeans IDE 5.0 is the SQL Editor. In fact, there never was an SQL Editor before. In NetBeans IDE 4.1 — and the releases before that — you had a very small space where you could type SQL commands for sending to the database.

Also, you could read more about the SQL Editor and related features from “David Van Couvering’s blog”, Embedding of SQL Editor support into PHP Editor from the “NetBeans PHP Team’s blog”. Finally, don’t miss out on the award-winning plugin (PL/SQL Editor) created during NetBeans Innovator Grants.

This is in fact my 150th blog entry over here.
Indeed, its a special one!

Hmmm…

So, this was just a brief overview of the features currently supported by NetBeans IDE. The follow-up blogs will continue to focus on either some/all of these features in detail.

This blog has been contributed to NetBeans Community Docs Program and for latest updates on this content, refer to the contribution.

Stay tuned for more..