Working with connections in the Database Explorer
You can work with the databases in the Database Explorer to perform all sorts of tasks. In this section, we will work with the SAMPLEDATABASE connection (which links to the SAMPLE database created using the db2sampl command). If you are following along, select the database connection that you specified in the previous section to link to the SAMPLE database.
When you are not connected to a database, you cannot work with its objects. You can right-click a database connection to connect to the database. This is how the Database Explorer looks when you are not connected to the database:
To connect to a database, highlight it, right-click, and select Reconnect, as shown below:
When you are connected to a database in the Database Explorer, the window has a toggle beside that database, which you can expand to explore that database's schema:
Note that during the reconnection process, Rational Application Developer has to repopulate the cache of the schema, so, depending on the size of the database, this could take a while. (Hint: use your filters!)
You can also edit a database connection by selecting Edit Connection from the pop-up window. This allows you to work with filters by turning them off, adding new filters, or removing them, and so on. Of course, you can delete a database connection by clicking Delete.
When you are connected to a database in the Database Explorer, you can choose to refresh the cache (for example, if you have added database objects since the last connection) by clicking Refresh, or terminate the connection by clicking Disconnect, as shown below:
From a connected database tree, you can perform all sorts of actions in the Database Explorer. Some of these I will cover in future articles, but I will briefly mention the most popular ones here.
With a connected database, you can browse data that resides in tables by right-clicking a table and selecting Sample contents:
You can also generate the DDL for an object by selecting Generate DDL. (I have shown how this feature works here, but it relies on a project that I will cover in a subsequent part of this series.)
Wrapping it all up
In this article, I showed you how to use the most common features of the Database Explorer in the Rational Application Developer IDE. In the next article, I will talk about Database Projects and how to create schema objects such as tables and views, within RAD.
About the Author
Paul C. Zikopoulos, BA, MBA, is an award-winning writer and speaker with the IBM Database Competitive Technologies team. He has more than ten years of experience with DB2 products and has written numerous magazine articles and books about it. Paul has co-authored the books: DB2 Version 8: The Official Guide, DB2: The Complete Reference, DB2 Fundamentals Certification for Dummies, DB2 for Dummies, and A DBA's Guide to Databases on Linux. Paul is a DB2 Certified Advanced Technical Expert (DRDA and Cluster/EEE) and a DB2 Certified Solutions Expert (Business Intelligence and Database Administration). Currently he is writing a book on the Apache Derby/IBM Derby database. You can reach him at: firstname.lastname@example.org.
IBM, Cloudscape, DB2, DB2 Universal Database, Rational, WebSphere, and z/OS are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Linux is a trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, and service names may be trademarks or service marks of others.
Copyright International Business Machines Corporation, 2005. All rights reserved.
The opinions, solutions, and advice in this article are from the author's experiences and are not intended to represent official communication from IBM or an endorsement of any products listed within. Neither the author nor IBM is liable for any of the contents in this article. The accuracy of the information in this article is based on the author's knowledge at the time of writing.