Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Eclipse Callisto Project Profile: Data Tools Platform : Page 2

Nearly all J2EE applications use a relational database of some kind. Eclipse provides an integrated set of tools for working with such databases in the Callisto Data Tools Platform.


WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

Connecting to a Database Using DTP

The first thing you need to do in DTP is set up a connection to your target database. Open the Preferences screen and choose "Connectivity -> Driver Definitions". DTP knows how to connect to a wide range of databases, including DB2, Derby, MySQL Oracle, and Sybase, as well as a generic JDBC connector.

Suppose you want to connect to a MySQL database. Choose the MySQL 4.1 entry and click on "Add". This will open the "New Driver Entry" window (see Figure 2), in which you select a JDBC driver and provide a name for your connection (you can have several connections of the same type to different databases, identified by different names).

Click to enlarge

Figure 2. Creating a New Database Connection

Next, you fill in the details for this particular connection. If this is the first time you've added a connection using this JDBC driver, you have to provide the path to the driver's jar file. And, not unreasonably, you also need to provide the usual JDBC connection details, such as the connection URL, user ID, and password (see Figure 3). Once this is done, your connection is ready for use!

Click to enlarge

Figure 3. Provide the Usual JDBC Connection Details

The Database Development Perspective

The DTP project provides a new perspective tailored for data-centric development: the Database Development perspective. Open this perspective ("Window -> Open Perspective -> Other -> Database Development"). One of its principal views is the Data Source Explorer, which lets you browse database structures using a feature called a Connection Profile. Think of a Connection Profile as an instance of the database connection you created previously. As you will see, you can either use a preexisting database connection as the basis for a Connection Profile or create a new one entirely from scratch.

To create a new Connection Profile to the database you just set up, go to the "Databases" node in the Data Source Explorer and choose "New..." in the contextual menu. This will open the "New Connection Profile" screen, which proposes a choice between a connection to an embedded Derby database ("Derby-Embedded Data") or a more general connection to a traditional JDBC database ("SQL Model – JDBC Connection"). Choose the latter. You will be prompted to provide a name for your profile, and then to enter the connection configuration details (see Figure 4).

Click to enlarge

Figure 4. Configuring the New Database Connection Profile

Here, you select one of the drivers configured in the Driver Definition screen as the basis for your connection. You can also supply supplementary properties to the JDBC driver and test the connection.

When you're done, the new connection profile will appear in the Data Source Explorer. From here, you can (as the name indicates) explore the structure of the database, which is represented in an intuitive tree-view structure (see Figure 5).

Click to enlarge

Figure 5. Exploring a Database Structure

This view provides a comprehensive look at the database structure: tables, columns, stored procedures, indexes, triggers, and so on. However, it is strictly read-only—no modification allowed. You can't query the database from this view either (you will see how to query the database further on). The only exception is you can run stored procedures from within this view. If your database has stored procedures, they will be listed under the entry of the same name. To run a stored procedure, simply select it and choose "Run..." in the contextual menu.

DTP Data Sources are not limited to relational databases. The ODA (Open Data Access) Data Sources also provide access to data from other sources, such as CSV and XML files, or even custom data sources.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date