皆の日本語

みんなのにほんご

The portal schema automatically has the appropriate access to the public APIs and secure views. To enable another schema to access the public APIs and secure views, use the following script:
MID_TIER_ORACLE_HOME/portal/admin/plsql/wwc/provsyns.sql

To provide access to the APIs:
  1. Change to the directory containing the provsyns.sql script:
    Windows: cd <MID_TIER_ORACLE_HOME>\portal\admin\plsql\wwc
    Linux/Unix: cd <MID_TIER_ORACLE_HOME>/portal/admin/plsql/wwc
    
    
  2. Log in to SQL*Plus as the portal schema owner. For example:
    sqlplus portal/oracle1
    
    
    You must run provsyns.sql as the portal schema owner. By default the portal schema is called PORTAL. An administrator can use Oracle Internet Directory to obtain the portal schema password as follows:
    1. Navigate to:
      • Entry Management
      • cn=OracleContext
      • cn=Products
      • cn=IAS
      • cn=Infrastructure Databases
      • OrclReferenceName=Infrastructure Database (for example, iasdb.server.domain.com)
      • OrclResourceName=Schema Name (for example, PORTAL)
    2. Click this entry.
    3. Look for the orclpasswordattribute value in the right panel. This is the schema password.
  3. Run the provsyns.sql script:
    SQL>@provsyns.sql <schema>
    (nếu ko chạy thì nhập vào đường dẫn tuyệt đối. VD 
    @C:\Oracle\portal\portal\admin\plsql\wwc\provsyns.sql diem)
    
    
    Where schema is the name of the schema to which you want to grant access.

    ref: http://docs.oracle.com/cd/B32110_01/portal.1013/b28978/pdg_pdk_plsql.htm#CHDFDCCJ

- tạo textbox input
      <input id="autocomplete"/>
-Javascript

<script>
    $(document).ready(function(){
        $("#autocomplete").autocomplete({
            source:'result.php'
        });
    });
</script>
trong đó result.php là trang xuất ra kết quả cần autocomplete, vì kết quả này cần lưu dưới dạng JSON (nhưng mà mình chưa biết JSON là gì cả) => xuất theo cấu trúc sau (để tìm ra cái này, mình mất cả ngày mới ngộ ra :D)
[{"value":"Than Hoang Phuong"}, {"value":"Nguyen Thi yen Phi"}, {"value":"Nguyen Thanh Duy"}, {"value":"Do Dinh Quan"}, {"value":"Nguyen Duy Cuong"}, {"value":"Nguyen Van Ngoc"}, {"value":"Le Huynh Dac"}, {"value":"Nguyen Hoang Du"}, {"value":"Le Van Luyen"}]
-OK xong rồi


Nâng cao 

Using jQuery UI Autocomplete with Hidden ID's


ref 

- Download file sql để run tại đây
- Kết nối Oracle bằng sqldeveloper
- Chạy file hr_main.sql
- Nếu bạn cài lần đầu thì phải unlock, gán role CONNECT và RESOURCE cho schema này (VD schema là HR) bằng lệnh sau
  ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;
 GRANT CONNECT, RESOURCE to hr;

- Connect vào HR, rồi chạy script  create and populate
Ref:
http://download.oracle.com/docs/cd/B13789_01/server.101/b10771/installation002.htm
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/common/connection11g.htm
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/common/files/b14198.pdf

-uncomment   extension=php_oracle.dll, extension=php_oci8.dll file php.info
-download oracle instant client
-copy all content (only content) of oracle instant client to apache/bin (or you can set PATH )
-restart xampp;
-test by following code


<?php
 $db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=v)(PORT=1521)) (CONNECT_DATA=(SID=pw)))';
//way 1
$c = oci_connect("pw", "pw", 'v:1521/pw');
//or way 2
$c = oci_connect("pw", "pw",  $db_test);

$s = oci_parse($c, 'select * from attendance ');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($res);
}
?>

ref http://www.apachefriends.org/f/viewtopic.php?p=143872

-Phải tạo bảng trước vì script ko hỗ trợ câu lệnh tạo bảng
-Để insert: Chọn database cần insert, chọn tab database object, chọn script.
-Câu lệnh insert như sau:
INSERT ALL
     INTO .....(giống như bt)
     INTO .....(giống như bt)
     INTO .....(giống như bt)
     .....
SELECT * FROM dual;

About this blog

Nguyễn Tuấn Anh
Khoa KH & KT MT (CSE)
ĐH Bách Khoa Tp.HCM (HCMUT)

Người theo dõi