Home » RDBMS Server » Networking and Gateways » 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 #44321] Thu, 27 November 2003 02:06
Rahul
Messages: 94
Registered: December 1998
Member
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
Previous Topic: TNS cud not resolve service name
Next Topic: differences b/w net8 & net9
Goto Forum:
  


Current Time: Thu Nov 21 21:19:23 CST 2024