Home » Developer & Programmer » Precompilers, OCI & OCCI » How to Configure LISTNER.ORA and TNSNAMES.ORA to RUN External Procedures in PL/SQL
How to Configure LISTNER.ORA and TNSNAMES.ORA to RUN External Procedures in PL/SQL [message #94055] Thu, 27 November 2003 02:10 Go to next message
Rahul
Messages: 94
Registered: December 1998
Member
Hi,

I have one C Dll that should be called in PL/SQL.

To achieve this, I have done the following steps but I am not successful.

Please go thru my solution, and suggest me how I can correct this problem.

Step 1:

Created shell.c

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
void __declspec(dllexport) sh(char *);
void sh(char *cmd)
{
system(cmd);
}

Step 2:

Compiled with the following options:

bcc32 -WD shell.c
implib shell.lib shell.dll
bcc32 shell_run.c shell.lib

Step 3:

Created Oracle Library

CREATE OR REPLACE LIBRARY DEMOLIB IS 'd:oracleora92binshell.dll';

Step 4:

Created Shell Procedure with External Lib

create or replace procedure shell
(
cmd IN varchar2)
as external
NAME "_sh"
LIBRARY "DEMOLIB"
LANGUAGE C
PARAMETERS (cmd string);
/

Step 5:

Testing the Procedure

exec shell('del c:a.txt');

I am get the following error.

BEGIN shell('del c:a.txt'); END;

*
ERROR at line 1:
ORA-28595: Extproc agent : Invalid DLL Path
ORA-06512: at "CON_OWNER.SHELL", line 0
ORA-06512: at line 1

Please refer my TNSNAMES.ORA and LISTENER.ORA

LISTENER.ORA
==============
# TNSNAMES.ORA Network Configuration File: D:oracleora92networkadmintnsnames.ora
# Generated by Oracle configuration tools.

CONDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = I3LCRMRENT2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ConDb)
)
)

ADSDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER)(PORT = 1521))
(CONNECT_DATA =
(SID = AdsDb)
)
)

DWHDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER)(PORT = 1521))
)
(CONNECT_DATA =
(SID = DwhDb)
)
)

SIBDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = i3lcrmrent2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = SibDb)
)
)

ODSDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER)(PORT = 1521))
)
(CONNECT_DATA =
(SID = OdsDb)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA = (SID = PLSExtProc)
)
)

LISTENER.ORA
==================
# LISTENER.ORA Network Configuration File: d:oracleOra92networkadminlistener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)

log_directory_callout_listener = d:oracle
trc_directory_callout_listener = d:oracle

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = d:oracleOra92)
(PROGRAM = d:oracleora92binextproc)
(ENVS="EXTPROC_DLLS=d:oracleora92binshell.dll")
)
(SID_DESC =
(ORACLE_HOME = d:oracleOra92)
(SID_NAME = SibDb)
)
(SID_DESC =
(ORACLE_HOME = d:oracleOra92)
(SID_NAME = OdsDb)
)
(SID_DESC =
(ORACLE_HOME = d:oracleOra92)
(SID_NAME = ConDb)
)
(SID_DESC =
(ORACLE_HOME = d:oracleOra92)
(SID_NAME = AdsDb)
)
(SID_DESC =
(ORACLE_HOME = d:oracleOra92)
(SID_NAME = DwhDb)
)


)

Note: My DLL has been placed in d:oracleora92bin
Re: How to Configure LISTNER.ORA and TNSNAMES.ORA to RUN External Procedures in PL/SQL [message #94099 is a reply to message #94055] Mon, 16 February 2004 19:12 Go to previous messageGo to next message
Sumi
Messages: 3
Registered: June 2002
Junior Member
Hi,
Am facing a similar problem while trying to use the OEXTPROC.DLL - ORA-28595: Extproc agent : Invalid DLL Path.
Could you please let me know how you resolved this ?

Thanks for your help
Sumithra
Re: How to Configure LISTNER.ORA and TNSNAMES.ORA to RUN External Procedures in PL/SQL [message #94163 is a reply to message #94099] Mon, 12 April 2004 01:01 Go to previous messageGo to next message
sarika
Messages: 1
Registered: April 2004
Junior Member
The problem what ur facing is bcoz of listener.ora,line 32 is wrong,check out the syntax,hope ur time is not good,go n chek for any well
Re: How to Configure LISTNER.ORA and TNSNAMES.ORA to RUN External Procedures in PL/SQL [message #94268 is a reply to message #94163] Thu, 24 June 2004 03:26 Go to previous message
platsch
Messages: 1
Registered: June 2004
Junior Member
add to listener.ora
(PROGRAM = extproc)
(ENVS="EXTPROC_DLLS=x:patha.dll;y:pathb.dll")
Previous Topic: OCCI getString problem
Next Topic: OCI/OCCI
Goto Forum:
  


Current Time: Thu Apr 18 04:09:02 CDT 2024