<< 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

prostaglandin and fever
Maha Reply
Discuss the differences between taste and flavor, including how other sensory inputs contribute to our  perception of flavor.
John Reply
taste refers to your understanding of the flavor . while flavor one The other hand is refers to sort of just a blend things.
Faith
While taste primarily relies on our taste buds, flavor involves a complex interplay between taste and aroma
Kamara
which drugs can we use for ulcers
Ummi Reply
omeprazole
Kamara
what
Renee
what is this
Renee
is a drug
Kamara
of anti-ulcer
Kamara
Omeprazole Cimetidine / Tagament For the complicated once ulcer - kit
Patrick
what is the function of lymphatic system
Nency Reply
Not really sure
Eli
to drain extracellular fluid all over the body.
asegid
The lymphatic system plays several crucial roles in the human body, functioning as a key component of the immune system and contributing to the maintenance of fluid balance. Its main functions include: 1. Immune Response: The lymphatic system produces and transports lymphocytes, which are a type of
asegid
to transport fluids fats proteins and lymphocytes to the blood stream as lymph
Adama
what is anatomy
Oyindarmola Reply
Anatomy is the identification and description of the structures of living things
Kamara
what's the difference between anatomy and physiology
Oyerinde Reply
Anatomy is the study of the structure of the body, while physiology is the study of the function of the body. Anatomy looks at the body's organs and systems, while physiology looks at how those organs and systems work together to keep the body functioning.
AI-Robot
what is enzymes all about?
Mohammed Reply
Enzymes are proteins that help speed up chemical reactions in our bodies. Enzymes are essential for digestion, liver function and much more. Too much or too little of a certain enzyme can cause health problems
Kamara
yes
Prince
how does the stomach protect itself from the damaging effects of HCl
Wulku Reply
little girl okay how does the stomach protect itself from the damaging effect of HCL
Wulku
it is because of the enzyme that the stomach produce that help the stomach from the damaging effect of HCL
Kamara
function of digestive system
Ali Reply
function of digestive
Ali
the diagram of the lungs
Adaeze Reply
what is the normal body temperature
Diya Reply
37 degrees selcius
Xolo
37°c
Stephanie
please why 37 degree selcius normal temperature
Mark
36.5
Simon
37°c
Iyogho
the normal temperature is 37°c or 98.6 °Fahrenheit is important for maintaining the homeostasis in the body the body regular this temperature through the process called thermoregulation which involves brain skin muscle and other organ working together to maintain stable internal temperature
Stephanie
37A c
Wulku
what is anaemia
Diya Reply
anaemia is the decrease in RBC count hemoglobin count and PVC count
Eniola
what is the pH of the vagina
Diya Reply
how does Lysin attack pathogens
Diya
acid
Mary
I information on anatomy position and digestive system and there enzyme
Elisha Reply
anatomy of the female external genitalia
Muhammad 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