<< Chapter < Page Chapter >> Page >
Mục tiêu: Chương này giới thiệu về thư viện đối tượng Remote Data Objects, cách thức được sử dụng để truy cập các đối tượng dữ liệu từ xa.

Học xong chương này, sinh viên phải nắm bắt được các vấn đề sau:

- Khái niệm Open Database Connectivity (ODBC).

- Sử dụng điều khiển dữ liệu từ xa (Remote Data Control) để truy cập dữ liệu.

- Cây phân cấp của mô hình đối tượng RDO.

- Sử dụng thư viện đối tượng RDO để tương tác với cơ sở dữ liệu trong VB.

Kiến thức có liên quan:

- Các cấu trúc lập trình trong VB.

- Câu lệnh truy vấn dữ liệu trong cơ sở dữ liệu.

- Nắm bắt được các mô hình DAO là một lợi thế vì lúc đó việc tiếp thu mô hình ADO được nhanh hơn.

Tài liệu tham khảo:

- Microsoft Visual Basic 6.0&Lập trình cơ sở dữ liệu – Chương 23, trang 735 - Nguyễn Thị Ngọc Mai (chủ biên), Nhà xuất bản Giáo dục - 2000.

- Tự học Lập trình cơ sở dữ liệu với Visual Basic 6 trong 21 ngày (T2) – Chương 17, trang 227 - Nguyễn Đình Tê (chủ biên), Nhà xuất bản Giáo dục - 2001.

Open Database Connectivity (ODBC)

Khái niệm

ODBC là công nghệ Windows cho phép ứng dụng Client nối với cơ sở dữ liệu từ xa. Nằm trên máy Client, ODBC làm cho nguồn dữ liệu quan hệ trở nên trong suốt đối với ứng dụng Client. Vì thế ứng dụng Client không cần quan tâm đến kiểu cơ sở dữ liệu là gì.

ODBC gồm 3 phần:

- Trình quản lý điều khiển (driver manager).

- Một hay nhiều trình điều khiển (driver).

- Một hay nhiều nguồn dữ liệu (data source).

Kiến trúc

Kiến trúc ODBC chứa kết nối giữa ứng dụng Client và cơ sở dữ liệu Server thông qua trình quản lý điều khiển ODBC.

Ứng dụng ClientNguồn dữ liệu ODBCTrình quản lý điều khiển ODBCTrình điều khiển ODBCDBHình 10.1: Kiến trúc ODBC trình bày kết nối giữa ứng dụng Client và CSDL Server thông qua trình quản lý điều khiển ODBC

Tạo nguồn dữ liệu odbc

Để một ứng dụng Client nối với cơ sở dữ liệu Client/Server dùng ODBC; trước hết, ta phải cung cấp thông tin về nguồn dữ liệu ODBC trên Client. Mỗi Server yêu cầu những gói thông tin khác nhau để nối với Client. ODBC cung cấp cho thông tin này một tên đơn giản để ta có thể tham chiếu đến nó, thay vì phải thiết lập gói thông tin từ đầu mỗi lần ta cần đến nó.

Ứng dụng Client có thể tham chiếu một cách dễ dàng đến tổ hợp của một điều khiển, một cơ sở dữ liệu và có thể thêm một người sử dụng và mật khẩu. Tên này chính là tên nguồn dữ liệu hay Data Source Name (DSN).

Để tạo một tên nguồn dữ liệu ODBC trên máy Client, ta làm như sau:

  • Mở Control Panel.
  • Chọn Administrative Tools\Data Source (ODBC), hộp thoại quản trị nguồn dữ liệu xuất hiện:

Hình 10.2: Hộp thoại quản trị nguồn dữ liệu ODBC

  • Ta có thể tạo một trong ba kiểu nguồn dữ liệu ODBC:
    • User DSN: chỉ có người dùng tạo ra nó mới có thể sử dụng (trên máy đang dùng).
    • System DSN: bất kỳ ai sử dụng máy này đều có thể dùng được. Đây cũng là kiểu nguồn dữ liệu mà ta cần tạo khi cài đặt ứng dụng cơ sở dữ liệu Web.
    • File DSN: có thể được copy và sử dụng bởi máy khác.
  • Khi hộp thoại ODBC đã mở ra, chọn lớp UserDSN (hay System DSN), Tạo một kết nối mới, nhấn nút Add, màn hình sẽ hiện ra như sau:

Hình 10.3: Lựa chọn loại cơ sở dữ liệu cần thiết để tạo kết nối

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Giáo trình visual basic. OpenStax CNX. Jul 29, 2009 Download for free at http://cnx.org/content/col10777/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Giáo trình visual basic' conversation and receive update notifications?

Ask