★ wanayoo — archive 1999 http://javaboutique.webdeveloper.com/Map_Java_Objects/index-2.htmlNouvelle recherche | Portail wanayoo
Computer Digital Expo


Find a Web Host With:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
Internet News
Internet Investing
IT
Windows Technology
Linux/Open Source
Developer
Interactive Marketing
xSP Resources
Small Business
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers
Be a Commerce Partner
Shop Digital Cameras
Software Licenses
Website Monitoring
Business Search
Send a Press Release
Promote Your Website
Find a Web Host
Free Market Research
Business Search
Find a Consultant
FlashKit
Gif.com
HierMenusCentral
JavaBoutique
JavaScript.com
JavaScriptSource
WebDev Jobs
JustSMIL
ScriptSearch
StreamingMediaWorld
Web Hosts
WebDevelopersJournal WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com
CGI
HTML
Java
JavaScript
Web Design and Promotion
Web Site Development
E-mail Address:


Can you receive
HTML e-mail?

Yes   No

Zip Code:



Reviews :

Mapping Java Objects to a Database with Castor-JDO:

Installation of MySQL

Castor supports all the well-known high-end databases like Oracle, DB2, MS SQL Server, but also Open Source databases like MySQL and Postgres. Here's the complete list of supported database systems. For all the examples in this article I've used MySQL, and for those of you who don't already have a database running on your computer I'll show you how to get one.   

You're always told that software is easy to install, right? This time it's true! MySQL is really simple to install and use. To use MySQL we need three software components: 

  • the MySQL server
  • a GUI client to administer the MySQL server
  • a Java JDBC driver 

You'll find them all on the MySQL download page: http://www.mysql.com/downloads/index.html.

The MySQL server: The production release is currently 3.23, but there is a "gamma" release called 4.0 which is recommended for new development, so let's pick that one. I used version 4.0.10 for this article. It's quite a bit to download, more than 20M for my Windows98 computer. On Windows you unzip the files, run the setup.exe, install in c:\mysql, and you're ready to go. 

There's a very comprehensive manual in the download, but why not start the server right away? Open a command prompt, go to the mysql\bin directory and type "mysqld", and the server is running. Verify this by typing "mysql" and you're in the server administrator. Now type "show databases;"--remember the semicolon! This will list the two databases--mysql and test--which come with the download. Enter "use test", and then create a new table called "media" in the "test" database:

create table media (id int primary key, type char(10) not null);

Enter "exit" to leave the administrator.   

The GUI client: Several clients exist. On the MySQL download page you'll find a link to "MySQL Control Center", which is a client that'll give you all the essential features you'd need to administer MySQL. Installation is straightforward. I used version 0.8.10 when preparing this article.

You should be able to see the new "media" table in the "test" database. 

The JDBC driver: Also on the download page you'll find "MySQL Connector/J", which is the official JDBC driver. Unzip the file you've downloaded and place the jar-file (there's only one) in your classpath. To see if your setup is correct try to compile and run this simple program that'll show the names of all tables in the "test" data base:

package hansen.playground;

import java.sql.*;

public class TestMySQL {
  public static void main(String[] args) {
    Connection connection = null;
    try {
      // Load the MySQL JDBC driver
      String driverName = "org.gjt.mm.mysql.Driver"; 
      Class.forName(driverName);
      
      // Create a connection to the "test" database
      String serverName = "localhost";
      String mydatabase = "test";
      String url = "jdbc:mysql://" + serverName +  "/" + mydatabase;
      String username = "root"; // default
      String password = ""; // default
      connection = DriverManager.getConnection(url, username, password);
      
      // Get the database metadata
      DatabaseMetaData dbmd = connection.getMetaData();
  
      // Specify the type of object; in this case we want tables
      String[] types = {"TABLE"};
      ResultSet resultSet = dbmd.getTables(null, null, "%", types);
  
      // Get the table names
      while (resultSet.next()) {
        // Get the table name
        String tableName = resultSet.getString(3);
        System.out.println("Table: " + tableName); 
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
}

- Listing 1: Testprogram for MySQL -


Applet Index
(sorted alphabetically)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z #s
The Java Source
(applets w/source code)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z

How to Add Java Applets to Your Site

New on the Java Boutique:

New Article:
A Barebones Guide to Usability Testing
At first glance, usability testing may seem like unnecessary, or additional work. In todays budget slashed world, it is not uncommon for projects not to have the luxury of this valuable phase. This is a dangerous path to tread. Let's look at how we can incorporate usability testing into our design process.
... [more articles]

New Tutorial:
Java Certification Path API
Certificate based security forms the basis for SSL (Secure socket layer) transactions? Every year billions of transactions involving trillions of dollars are done safely using the SSL protocol. This week we'll look at the role of the Java certification path API and see how it provides a mechanism to implement certification path functionality.
... [more Tutorials]

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

internet.com logo






Developer News

Is Adobe Targeting Microsoft's InfoPath?

Oracle Takes on Collaboration Market

DoS Flaw in Cisco Router, Switches



Database Journal Launched!
Jupiter Media has announced the launch of Database Journal. DBJ offers SQL courses and other database related resources for beginner to expert developers.



Scrolling Text
This is a suite of three applets that displays scrolling text using an array of images. The detailed description of array of each applet is provided.
Download of the Week
DS PageFlipText
This applet displays a page-flip effect between texts. Over the animation you can also insert an image and a scroll-text.

JB User Poll
Which version of Java do you use the most?
The JavaBoutique Top 15:
1. ChompText
2. NavBar
3. DJPopMenu
4. PulseText
5. PingPong
6. 3DMaze
7. Encyclo
8. Viewer
9. AScroll2
10. Distorter
11. Jtimer
12. BMI
13. AnimLetters_anim
14. BMMenu
15. AScratchNWin
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
Internet Tax Ban Hits Congressional Fast Track
Bills to permanently extend current moratorium on Internet access taxes move in House and Senate.

UK Texting Takes Off
More than 8 billion text messages were sent across the UK since the beginning of 2003, while traffic to U.S. mobile phone Web sites spikes 106 percent during the same time period.

Intersil Drops Wi-Fi
The maker of the PRISM line of WLAN chips is saying good-bye to Wi-Fi and divesting itself of its wireless product business. The chips go to broadband circuit maker GlobespanVirata for approximately $365 million.


Jupitermedia is publisher of the internet.com and EarthWeb.com networks.
Copyright 2003 Jupitermedia Corporation All Rights Reserved.

Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.earthweb.com/
http://www.internet.com/