Working with Databases from Eclipse - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Working with Databases from Eclipse

Description:

... used to connect to the MySQL database via a JDBC driver contained in a .jar file ... Unpack the archive into the directory of your choice CONNECTOR-HOME ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 10
Provided by: Nad972
Category:

less

Transcript and Presenter's Notes

Title: Working with Databases from Eclipse


1
  • Working with Databases from Eclipse
  • Prepared by Nadya Kuzmina

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

3
Install MySql Database
  • Download MySQL 5.0 Community Server
    (http//dev.mysql.com/downloads/mysql/5.0.htmldow
    nloads)
  • Follow installation instructions in the MySql
    Manual (http//dev.mysql.com/doc/refman/5.0/en/win
    dows-install-wizard.html)

4
Connector/J
  • Download MySQL Connector/J (http//dev.mysql.com/d
    ownloads/connector/j/5.0.html)
  • Unpack the archive into the directory of your
    choice ltCONNECTOR-HOMEgt

5
Eclipse SQL Explorer Plugin
  • In Eclipse,
  • Help -gt Software Updates -gt Find And Install
  • In the Update Sites to Visit Panel, click New
    Remote Site Button
  • Enter the name and http//eclipsesql.sourceforge.n
    et/ for URL
  • Run the Wizard to install SQL Explorer Plugin
  • Restart Eclipse

6
Configuring SQL Explorer to work with MySQL
Database
  • Configure your JDBC Driver preferences as
    described in http//eclipsesql.sourceforge.net/dri
    vers.php
  • Configure your connections as described in
    http//eclipsesql.sourceforge.net/connections.php

7
Create and Populate Tables 2
  • Use the following command to create tables
  • CREATE TABLE Catalog(CatalogId 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')

8
Example Java Code Which Works with a MySQL
database.Note For good design use a
DAO!(example is at http//www.cs.uwyo.edu/nadya
/Connect.java)
9
References
  • Eclipse SQL Explorer (http//eclipsesql.sourceforg
    e.net/index.php)
  • Deepak Vohra Configuring Database Access in
    Eclipse 3.0 with SQLExplorer (http//www.onjava.co
    m/pub/a/onjava/2005/05/11/sqlexplorer.html?page1)
Write a Comment
User Comments (0)
About PowerShow.com