facebook

Database Tools in MyEclipse

1. Database Tools for Enterprise Applications

When developing Java enterprise applications, there is frequently a need to store and retrieve data from application and enterprise databases. MyEclipse’s rich set of database and persistence features enable you to rapidly develop database-centric applications using Java EE, Spring, Hibernate, POJOs, or combinations thereof.

The MyEclipse Database Explorer enables direct access to your enterprise data stores and provides the following features:

Any application that uses a database needs some sort of a persistence layer. MyEclipse supports persistence creation or generation using the JPA OR Mapping,  Hibernate OR Mapping or EJBs with or without using the Spring framework.

2. MyEclipse Database Explorer Perspective

The Database Explorer perspective presents an optimal layout of views and editors for database-centric tasks. To open this perspective, select Window>Perspective>Open Perspective>Database Explorer from the menu.

dbtoolsperspective
MyEclipse Database Explorer perspective

3. Working with Drivers

You can create new MyEclipse JDBC drivers for connecting to your database. The MyEclipse Database Explorer supports many database servers such as:

  • Axion
  • Hypersonic DB
  • InstantDB
  • Interclient
  • Firebird
  • ODBC Bridge
  • jTDS
  • Mckoi
  • Microsoft SQL Server
  • Mimer SQL
  • MySQL
  • Oracle
  • Pointbase
  • PostgresQL
  • SAPDB
  • Sunopsis XML
  • Sybase
  • ThinkSQL

 

Add a new driver using the context menu in the DB Browser view.


Creating a new driver


Use the Database Driver wizard to quickly set up the driver using pre-installed driver templates. Use the Test Driver button to ensure supplied details are correct.


Database Driver wizard

You can choose to see all catalogs/schemata in your database or only a selected few.


Selecting schema

Use the Export and Import wizards to share driver definitions between workspaces and machines.


Exporting MyEclipse drivers

MyEclipse drivers can be imported either from a previously exported file or from an existing workspace.


Importing MyEclipse drivers

4. Database Explorer Views and Wizards

The DB Browser view is the primary view from which DB tasks can be initiated. Database entities from all connected drivers are displayed in this view.


DB Browser view


Available table actions

Use the Table wizard to create new tables in the selected catalog/schema.

dbtoolsnewdbtable
New Table wizard

dbtoolsnewdbcolumn
New Column wizard

Use the Foreign Key wizard to create a new foreign key between selected tables.

dbtoolsnewforeignkey
New Foreign Key wizard

Use the Index wizard to create a new index on column(s) of a selected table.

dbtoolsnewindex
New Index wizard

The DB Connection Info view displays database connection properties for the selected driver.


DB Connection Info view

The Table/Object Info view contains a structured display of all available data from the selected database entity.


Table/Object Info view

Use the Edit Data action to bring up an Edit Table view for the selected table. Textual data can be edited in place, and you can add or delete table rows from the Edit Table view.


Edit table view

5. Working with SQL

Open the SQL editor by right-clicking an open connection in the DB Browser, and selecting New SQL Editor from the menu. Alternatively, double-click a SQL or DDL file.


Opening an SQL editor

The SQL editor provides content assist based on the selected connection. You can enter multiple queries in the editor and execute them successively.


SQL editor column content assist


SQL editor general content assist

Results are displayed in the SQL Results view; rows are fetched in configurable increments.


SQL Results view displaying first 100 results

Queries executed in the current session are recorded in the SQL History view.


SQL History view

Generate DDL for existing database entities by right-clicking the entity and selecting Generate>DDL from the menu.


Generate DDL action


Generated DDL

6. Entity Relationship Designer

The MyEclipse ER-Designer helps you visually manage the lifecycle of a relational database from design, through implementation, and maintenance. The MyEclipse ER-Designer provides a visual model of existing databases. The ER-Designer utilizes the database connectors of the Database Explorer to access a database’s metadata as it reverse engineers the database’s entity-relationship (ER) model.

dbtoolsnewerd
New ERD wizard

Tables can be added to an existing diagram by dragging and dropping them from the DB Browser.


ER Diagram

7. Extended Oracle, MySQL, SQL Server and Sybase Features

MyEclipse professional subscribers have access to extended support for the above databases. CRUD operations (where applicable) for packages, procedures, functions, sequences, triggers, etc. are available through the DB Browser view. For example, a list of supported Oracle entities can be seen below.


DB Browser view connected to an Oracle DB


Running an Oracle procedure

For More details on the extended support, please see the following overview documents:
Oracle Features in MyEclipse 
MySQL Features in MyEclipse 
MS SQL Server & Sybase Features in MyEclipse

8. FAQ

Does MyEclipse support Oracle, MS SQL Server, PostgreSQL, HypersonicSQL and other DBMSs?
Yes, MyEclipse’s database functions are built on top of the JDBC standard. That means any database that has a high-quality JDBC driver should function just fine with MyEclipse.

I am having a hard time using the Database Explorer; it is acting erratic.
Almost every time we have gotten reports of database function problems in the Database Explorer, it was due to an old or buggy JDBC driver (for example the older classes12.zip driver for Oracle). Normally, upgrading your driver or switching to another high-quality driver solves the problem.

I cannot see or create foreign keys in MySQL like you did in the tutorial. Why?
You need to make sure you are using the InnoDB database type or other database type that supports foreign keys in MySQL. The older default MyISAM table type does not support foreign keys.

How can I fine-tune the limits of my result sets or the look of my ER Diagrams?
All these settings can be found by selecting Window>Preferences>Database and making selections for each area.