Technical Support
Discussion Forum
Online Training
Read About Java
Java In-Depth
Product Discounts
Membership Information JDC Resources DukeDollars

Java Cup Logo

JDC Home Page

JDC Applets
(chat, newsreader, calendar)

Log Out

Online Training
shadowSearchFAQFeedback

Course Notes Table of Contents | Exercises
JDBC Short Course Index | Online Training Index

Getting Started
Working Applet | Help
Solution

This exercise helps you set up your system for the remaining exercises. There are basically two steps: The first is to create an ODBC-accessible datasource to use, and the second is register it with your system.

If you care to use Microsoft Access or text files as your source, MageLang provides the startup files to use. If you want to use something like Personal Oracle, SQL Server, or dbAnywhere, MageLang provides a Java application in which to setup the necessary tables.

Perform the following tasks:

  1. Pick a system to use as the datasource.
    • Microsoft Access
      • Make a directory for the database
      • Copy testdb.mdb file to that directory
    • Text Files
    • Oracle / SQL Server / dbAnywhere / ...
      • This option is not available in the standard MageLang lab environments.
      • The SQL scripts comments.sql, instructors.sql, and students.sql, need to be run against your database. You can modify the loadme.bat file to run with your server, or load them directly into an interactive SQL GUI tool, or run the MageSetup program. However, you cannot run any of them until you complete Step 2.
    • mSQL is not recommended for exercises because the current implementation does not permit access to database metadata or use of prepared statements.

  2. From Windows 95/NT 4.0:
    • Bring up Control Panel
      • Select the Start button
      • Select the Settings menu item
      • Select the Control Panel menu item
    • Find and double-click on the ODBC Icon (32-bit/with 32 on it). This brings up the 'Data Sources' window.
    • Select Add. This brings up the Add Data Source window.
    • Select the driver for the type of driver you want.
      If you selected Text, the ODBC Text Setup window appears.
      • Name the data source mage.
      • Fill in a description.
      • Select the directory in which you placed files from the initial task.
      • Select OK to accept new driver.
      If you selected Microsoft Access, the ODBC Microsoft Access 7.0 Setup window appears.
      • Name the data source mage.
      • Fill in a description.
      • Click on the Select button to bring up a file dialog.
      • Locate the directory created in task 1.
      • Select OK to accept new driver.
    From Solaris 2.x:
    • For Intersolv ODBC Bridge
      • Edit the odbc.ini file in the Intersolv installation directory, possibly /opt/Intersolv, to define a data source mage.
        If your database server happens to be Oracle 7, you can use an entry similar to this.
      • Update the database server to map the ODBC name to a database entry.
        If your database server happens to be Oracle 7, you can add an entry similar to this to Oracle's tnsnames.ora file. The sample file maps mage to the Oracle sid examplesid.
      • Configure your CLASSPATH to point to the JDBC classes, the InterSolv classes, and to find the ODBC driver. A sample bourne shell script is provided.

Windows NOTE: If your machine does not have Microsoft's ODBC Desktop Database Drivers 3.5 for 32-Bit Programs installed, you can read Microsoft's Knowledge Base entry with installation instructions and their licensing agreement. The actual drivers are available here, with their readme file.

Solaris, and other platforms, NOTE: Intersolv has ODBC and JDBC drivers available for most major database platforms through their DataDirect Series.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution, which meets these requirements, and Expected Behavior.


Copyright © 1997 MageLang Institute. All Rights Reserved
May-97 Copyright © 1996, 1997 Sun Microsystems Inc. All Rights Reserved