Working with Databases from Eclipse Prepared by Nadya

Working with Databases from Eclipse Prepared by Nadya Kuzmina

What You Need: • My. Sql Community Server • Connector/J, which is used to connect to the My. SQL database via a JDBC driver contained in a. jar file • Eclipse SQL Explorer Plugin

Install My. Sql Database • Download My. SQL 5. 0 Community Server (http: //dev. mysql. com/downloads/mysql/5. 0. html#downloads) • Follow installation instructions in the My. Sql Manual (http: //dev. mysql. com/doc/refman/5. 0/en/windows-installwizard. html)

Connector/J • Download My. SQL Connector/J (http: //dev. mysql. com/downloads/connector/j/5. 0. html) • Unpack the archive into the directory of your choice <CONNECTOR-HOME>

Eclipse SQL Explorer Plugin • In Eclipse, – Help -> Software Updates -> Find And Install – In the “Update Sites to Visit” Panel, click “New Remote Site” Button – Enter the name and http: //eclipsesql. sourceforge. net/ for URL – Run the Wizard to install SQL Explorer Plugin – Restart Eclipse

Configuring SQL Explorer to work with My. SQL Database • Configure your JDBC Driver preferences as described in http: //eclipsesql. sourceforge. net/drivers. php • Configure your connections as described in http: //eclipsesql. sourceforge. net/connections. php
![Create and Populate Tables [2] Use the following command to create tables: CREATE TABLE Create and Populate Tables [2] Use the following command to create tables: CREATE TABLE](http://slidetodoc.com/presentation_image_h2/a3c193c7a9601a15832df3aec3c8e6fc/image-7.jpg)
Create and Populate Tables [2] Use the following command to create tables: CREATE TABLE Catalog(Catalog. Id INTEGER, Journal VARCHAR(25), Publisher Varchar(25), Date VARCHAR(25), Title Varchar(45), Author Varchar(25)); INSERT INTO Catalog VALUES('1', 'onjava', 'OReilly', 'April 2005', 'Five Favorite Features from 5. 0', 'David Flanagan'); INSERT INTO Catalog VALUES('2', 'onjava', 'OReilly', 'Feb 2005', 'Introducing JBoss Remoting', 'John Mazzitelli'); INSERT INTO Catalog VALUES('3', 'onjava', 'OReilly', 'March 2005', 'Aspect-Oriented Annotations', 'Bill Burke');

Example Java Code Which Works with a My. SQL database. Note: For good design use a DAO! (example is at http: //www. cs. uwyo. edu/~nadya/Connect. java)

References: • Eclipse SQL Explorer (http: //eclipsesql. sourceforge. net/index. php) • Deepak Vohra Configuring Database Access in Eclipse 3. 0 with SQLExplorer (http: //www. onjava. com/pub/a/onjava/2 005/05/11/sqlexplorer. html? page=1)
- Slides: 9