|
Using OiD with
PL/SQL
Oracle ได้นำเสนอ Oid SDK(Oracle Internet Directory Software Developer's
Kit) เพื่อให้ Developer สามารถพัฒนา Application ที่ต้องติดต่อใช้งานDirectory
Server ในรูปแบบต่าง ๆ
Components of the Oracle Internet Directory Software Developers
Kit
OiD SDK 2.1.1 จะประกอบด้วยส่วนประกอบหลัก ๆ ดังนี้
- An LDAP Version 2-compliant C
API
- A PL/SQL API contained in a PL/SQL
package called DBMS_LDAP
- Sample programs
- Oracle Internet Directory Application
Developers Guide
- Command line tools
ในตัวอย่างนี้จะพูดถึงเฉพาะส่วนที่เป็น PL/SQL API
The Oracle Internet
Directory PL/SQL API
ใน Package ชื่อ DMBS_LDAP จะมี Oracle Internet Directory PL/SQL
API ซึ่งเป็น API ที่ทำหน้าที่ติดต่อกับ LDAP Server ต่างๆ
Using the PL/SQL
API for a Search
ตัวอย่างนี้จะเป็นการเรียกใช้ DMBS_LDAP API เพื่อทำการค้นหาข้อมูลที่เราต้องการ
โดยพัฒนาด้วย PL/SQL
การค้นหาจะทำการค้นหาจาก Base ของ dc=exzilla,dc=com และทำการค้นหาในลักษณะที่เป็น
subtree โดยจะทำการ แสดงค่าต่าง ๆ ที่อยู่ภายใต้ Subtree มาแสดง
Building Applications
with PL/SQL LDAP API
ก่อนที่เราจะใช้งาน PL/SQL LDAP API ได้นั้นเราต้องแน่ใจว่า Database
ที่เราทำงานด้วยมี DBMS_LDAP Package อยู่ก่อน
สำหรับ Database ที่ยังไม่มี DBMS_LDAP Package นั้นเราต้องทำการสร้าง
DBMS_LDAP Package กันก่อนโดย run script $HOME/rdbms/admin/catldap.sql
ดังตัวอย่าง
|
SQL> CONNECT
/ AS SYSDBA
SQL> @?/rdbms/admin/catldap.sql
|
The
typical sequence of DBMS_LDAP:
|
DBMS_LDAP.init()
// initializes a session with an LDAP server.
|
DBMS_LDAP.simple_bind_s()
// perform simple user name/password based authentication
to the directory server.
|
Do Search, update
,insert and display the results
|
DBMS_LDAP.unbind()
//Used for closing an active LDAP session.
|
Sample Code
REFs:
1.Oracle Internet Directory Application Developers Guide, Release
2.1.1
Part ,No. A86082-01
( You can download from OTN)
2.$ORACLE_HOME/ldap/demo/plsql/search.sql sample program.
More Info:
1.Oracle Internet Directory Application Developers Guide, Release
2.1.1
Part ,No. A86082-01( You can download from OTN)
2.$ORACLE_HOME/ldap/demo/plsql/search.sql sample program.
3.http://www.openldap.org/
4.http://www.redhat.com/
Keywords:
ldap oid plsql ldap search oid oracle pl/sql sdk api
|