首页 > 数据库 > Oracle > Oracle Apache的一些应用
APEX中都是设置好的一些WEB应用,你也可以自己在Apache中对dads.conf文件进行设置以调用后台数据库的过程等。以下一些介绍是对《精通Oracle PL/SQL》书中第9章“Web包”,359页的一些补充。
以下是新的Location的设置,tst对应了后台数据库的test2 schema:
APEX中都是设置好的一些WEB应用,你也可以自己在Apache中对dads.conf文件进行设置以调用后台数据库的过程等。以下一些介绍是对《精通Oracle PL/SQL》书中第9章“Web包”,359页的一些补充。
以下是新的Location的设置,tst对应了后台数据库的test2 schema:
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDatabaseConnectString pc_name:1521:db_sid
PlsqlNLSLanguage American_America.ZHS16GBK
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename mydocs
PlsqlDatabaseUsername test2
PlsqlExclusionList hello*
PlsqlDatabasePassword test2test2test2
Allow from all
黑体的地方需要根据自己的数据库情况进行修改,其中有几个地方需要注意:
1, PlsqlNLSLanguage American_America.ZHS16GBK
如果没有设置ZHS16GBK,系统上传文件后文件名中的中文会乱码。可以通过下面的sql获得相关信息:
select value, parameter
from nls_database_parameters
WHERE PARAMETER IN
('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');
2, PlsqlDocumentTablename mydocs
后台数据库存放上传文件的表名。
3, PlsqlExclusionList hello*
控制web访问后台过程或其他程序的黑名单,*是通配符。注意前期APEX是使用function来控制白名单,这里是通过黑名单来限制。
4, 另外wpg_docload包位于sys下。下载时出现文件名总是以get_file为起始,没有显示原始文件名。可以修改Page 362中的get_file过程来解决,注意以下黑体部分:
create or replace
procedure get_file( p_id in number )
as
begin
for c1 in (select mime_type, blob_content, name
from mydocs
where id = p_id) loop
--
-- Setup the HTTP headers
--
owa_util.mime_header( c1.mime_type, FALSE );
HTP.P('Content-length: ' || DBMS_LOB.GETLENGTH( C1.BLOB_CONTENT ));
htp.p('Content-Disposition: inline; filename="'||replace(replace(c1.name,chr(10),null),chr(13),null)|| '"' );
owa_util.http_header_close;
-- Then give mod_plsql the BLOB content
wpg_docload.download_file( c1.blob_content);
--
exit;
end loop;
END;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1513/viewspace-1031471/ ,如需转载,请注明出处,否则将追究法律责任。