RAD to Database Connection - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

RAD to Database Connection

Description:

Refer to Exercise 20 of Tutorial 12 for information on how to test TclODBC ... Remember to select Microsoft Access Driver' and browse for the database you wish ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 14
Provided by: SystemsAdm2
Category:

less

Transcript and Presenter's Notes

Title: RAD to Database Connection


1
RAD to Database Connection
  • Glenn Campbell
  • Campbell-g8_at_ulster.ac.uk

2
Learning Outcomes
  • After this lesson you will be familiar with
  • TclODBC
  • Linking RAD application to database
  • Creating an ODBC Data Source Name (DSN)
  • TCL commands
  • Using SQL to query a database

3
TclODBC
  • Extension to TCL (Tool Command Language) which
    allows access to databases
  • Uses standard ODBC interface
  • The Rapid Application Developer (RAD) can be
    configured to link to a database
  • We will use MS Access for creating the database

4
Initial Steps
  • Before you begin, do the following
  • Download and install TclODBC from course website
  • Create a database in MS Access called name.mdb
    e.g. student.mdb
  • We can now create a link between the database and
    the RAD application

5
Testing TclODBC
  • Refer to Exercise 20 of Tutorial 12 for
    information on how to test TclODBC in the CSLUsh
    window.
  • When you are satisfied that TclODBC is working,
    you can then create a link between your RAD
    application and the Database.

6
RAD to database connection
  • The RAD to database connection is achieved using
    the following steps
  • Step 1 Create a link between the RAD and the
    database
  • Step 2 Create an ODBC Data Source Name (DSN) for
    your database
  • Step 3 Create a database object to open a
    connection to the database
  • Step 4 Use SQL to query the database

7
Step 1 RAD database link
  • Download TclODBC package into the
  • . . . \CSLU\Toolkit\2.0\pkg\tclodbc2.2 directory
  • Use the following command to create a link
    between RAD and the database
  • package require tclodbc
  • This command loads the TclODBC program which
    creates a link between RAD and the database
  • This (and any other) TCL command can be inserted
    into the On Exit tab of an Action Object

8
Step 2 Create an ODBC DSN
  • Select
  • Start Control Panel Administrative Tools
    Data Sources (ODBC) Add
  • Now enter required information. For example, in
    this example, enter student as the Data Source
    Name (i.e. the name of the database)
  • Remember to select Microsoft Access Driver and
    browse for the database you wish to link to.

9
(No Transcript)
10
Step 3 Create database object
  • Use the command database to create a database
    object, db which refers to the DSN created in
    Step 2
  • To do this use the following command
  • Database db name
  • where name is the name of the database, e.g.
    student

11
Step 4 Query the database
  • The database can now be queried using SQL
  • Again, the code is entered into the Action
    object
  • For example
  • set getDetails db "Select Name from
    StudentRecords where StudentNumber value "
  • where Name and StudentNumber are all fields in
    the StudentRecords table of the student database

12
Access 2007 Considerations
  • Note that this presentation is related to MS
    Access 2003
  • It does work with MS Access 2007
  • But there may be some subtle changes in the way
    tclODBC is used

13
Further Information
  • Paul Mc Kevitts course website
  • http//www.infm.ulst.ac.uk/paul/com556m2/
  • CSLU Toolkit webpage
  • http//cslu.cse.ogi.edu/toolkit/
  • Email me
  • Campbell-g8_at_ulster.ac.uk
Write a Comment
User Comments (0)
About PowerShow.com