Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Remote Online Backup
Find Software
Corporate Awards
Baby Photo Contest
Promos and Premiums
Rackmount LCD Monitor
Boat Donations
Laptop Batteries
Cell Phones
Home Improvement
Shop Online
Televisions
Disney World Tickets
Career Education




MySpace Joins eBay, Yahoo in Open Profile Push

News Corp. Unit Under Fire for Ties to Hacker

Are Non-PC Devices Hurting 'Net Innovation?

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Guide to Oracle 11g and Database Migration
Oracle Database 11g includes more features for self-management and automation, which makes it easier for customers to cost-effectively manage their data. Download this Internet.com eBook for an overview of some of the new features in 11g and for an overview of the issues you need to consider as you prepare for a database migration. »
Innovate Faster with Oracle Database 11g
Read this in-depth analysis of 56 customers, which shows significant differences between the value software vendors Oracle and SAP deliver to midsize companies. »
Oracle Business Intelligence Standard Edition One
Find out how Newport Beach, CA-based Mobilitie is shaking up the telecom industry by leveraging technology to provide an entirely different financial model for deploying, upgrading, and owning wireless and wireline network assets. »
Business Intelligence and Enterprise Performance Management: Trends for Emerging Businesses
Quickly implementing an ERP software solution can be of tremendous benefit; however, companies often struggle to balance the benefits of reducing implementation time and cost with the risks of an accelerated deployment. Read this white paper to learn about easy-to-follow best practices for achieving a successful accelerated implementation. »
Making the Case for Oracle Database on Windows
Users benefit as vendors reduce enterprise complexity and deliver integration. »
Related Articles
DB2 9.5 and IBM Data Studio Part 3: Overview diagrams - the basics
DB2 9.5 and the IBM Data Studio - Part 2
DB2 Viper II and the IBM Data Studio Developer Workbench

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
DB2
March 17, 2008
DB2 9.5 and IBM Data Studio: Part 8: The SQL Builder Development Accelerators – The Rest of the Story
By Paul Zikopoulos

So far in this series about the IBM Data Studio integrated development environment (IDE) that’s available with DB2 Version 9.5 (DB2 9.5), I’ve shown you how to set up database connection objects and the actions that you can perform on them. In addition, I introduced you (in Part 2) to some of the features available in the Database Explorer view, and Part 3 and Part 4 gave you a full tour of overview diagrams. In Part 5, you learned how to point-and-click your way to OLE DB functions that can integrate data from external data sources that have an OLE DB provider. In Part 6, I showed you how easy it is to create an SQL statement using the IBM Data Studio SQL Builder. Part 7 introduced you to a set of rapid application development features within IBM Data Studio that takes your SQL development capabilities to a whole new level. Specifically, I introduced you to my favorite SQL Builder features: namely, SQL Assist, Content Tip, colorization, and the design-time parser. In this installment, I finish the tour of the SQL Builder features that help you get to an extreme development paradigm.

Things you have to do to follow the examples in this article...

I recommend for that all the multi-part articles I write that you start with Part 1 because I tend to build on the concepts and objects created in these series sequentially. For this article, I assume that you’ve read through Part 7 and your Database Explorer view looks like this:

More Development Assistance from the SQL Builder

In this section, I’ll detail the rest of the SQL Builder features that help boost productivity when you’re designing SQL statements using the FEMALEPERSONNEL2 query, which we built in Part 7 of this series.

Standard Editing Functions

IBM Data Studio comes with a number of basic text editing capabilities such as cut, copy, and paste, that users of word-processing software, spreadsheets, and more are accustomed to. As well, there are more advanced features such as undo, revert, format, indent, and so on. These features really come in handy when you are designing SQL statements.

To access the basic editing features (I’ll cover some of the more advanced ones in a bit), simply right-click within the design canvas of the SQL Builder:

Revert to Last Correct Source

Quite often, you’ll find yourself editing your SQL and making a mistake (or perhaps it’s just me). The Revert to Last Correct Source option comes in very handy. For example, add a D to the DEPARTMENT table name such that it looks like:

Now save this SQL statement (press Ctrl+S). You should receive an error message similar to this:

The SQL Builder is smart enough to see that this table doesn’t exist, and alerts you to this error when you try to save the statement. Click OK and then press Ctrl+S to override the real time parser in IBM Data Studio and save the query with the error.

Note: Make sure you save your SQL statement to enable this option. You can tell that your statement hasn’t been saved when an asterisk (*) prefixes the name of the SQL statement. When a statement is successfully saved (even with an error) the asterisk disappears, as shown below:

To have IBM Data Studio return the SQL statement to the last known version of it that worked, right-click in the SQL Builder and select Revert to Last Correct Source. IBM Data Studio will open a window that contains that last SQL statement that it successfully parsed. You can probably figure out what happens if you click OK at this point:

As you can see in the previous figure, IBM Data Studio changed the SQL statement back to the last time the SQL you wrote was valid. I like this feature because I often work off an SQL template, a stub file, or some sample SQL statement that I copied from the DB2 documentation or some article. If I mess it up, I know that I’ve got IBM Data Studio watching my back. What’s more, it seems that IBM Data Studio can remember that last version of your SQL statement that worked even after you close and subsequently reopen your SQL statement; that means the ‘state’ of the help engine persists across editing sessions!

Clear to Template

This option takes your SQL statement, as well as any changes you’ve made, and replaces it with the original template you worked with. For example, create the same error in the SQL statement that you just did in the previous section, but this time select the Clear to Template option.

If you recall from Part 5, we created an SQL statement using the SELECT template, and this is why the SQL statement reverted back to what’s shown below:

In this case, don’t save the SQL statement; just close it by clicking . By now you’re likely wondering why you would want to leverage this option. After all, you just spent time writing a full SQL statement, adding tables, specifying an ordering for the result set, and more.

In this example, we built the SQL statement from a simple SELECT statement. As you likely noticed, the built-in templates in the SQL Builder are very simple. The good news is that you can create customized templates that you can leverage within the SQL Editor (they are not available within the SQL Builder at this present time, but I expect that to change) and revert back to the template you defined. (I’ll introduce you to templates in the next section and discuss the SQL Editor in the next article.) If you recall, I’ve discussed how you would use a combination of the SQL Builder and the SQL Editor. For example, despite the fact that we created the FEMALEPERSONNEL SQL statement using the SQL Builder, you can subsequently open it using the SQL Editor and get all of the functionality that’s only available within the SQL Editor (such as templates) for your SQL statement:

In the future, these two editors may be merged into a single editor. One thing to note, however: there may come a point at which your SQL statement gets too complex for the SQL Builder and can only be opened in the SQL Editor. Those of us who have to write SQL statements daily as part of our jobs will likely feel the SQL Editor is the right trade-off between personal knowledge and design assistance.

Run your SQL

It’s good to know that you can run your SQL statement directly from the SQL Builder. This handy option enables you to quickly look at the result set for your SQL statements with a click of a button. Now think about extending such a benefit when you are in the Java perspective and writing a Java application. Forget about the fact that IBM Data Studio gives you SQL assistance when in the Java perspective, but the fact that you don’t have to write Java code or create a JUnit program to run your SQL is the big benefit here. These topics are outside the scope of this article, but this simple feature will prove to be very beneficial through the data lifecycle management process that I outlined in “DB2 9.5 and IBM Data Studio: Things I Couldn’t Tell You before DB2 9.5 Was Announced”.

Go to page: 1  2  Next  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

DB2 Archives

Best Practices: Make the Case for IT Investments. Complimentary Independent Report. Download Now!
Webcast: Five Virtualization Trends to Watch. Produced for HP, Citrix, and Intel.
Whitepaper: Enterprise Information Integration--Deployment Best Practices for Low-Cost Implementation
Flash Demo: Learn how IBM Information Server Blade is easy to manage, highly scalable and efficient.
HP eBook: Using Business Service Management (BSM) to Manage Your Business Applications


Latest Forum Threads
DB2 Forum
Topic By Replies Updated
database files move????? db2dba 1 March 25th, 09:02 AM
Missing objects in sysproc schema bocap 0 March 3rd, 07:44 PM
Linked Server - Connect to db2 rayan127 0 February 22nd, 02:10 PM
Difference in DB2 Date returned Indresh_Chadha 1 February 19th, 01:24 PM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES