Cannot connect to sample external c function - ORA-06521: ORA-06522
631262Sep 16 2008 — edited Sep 17 2008I'm trying to use the sample extern.c external procedure that came with my oracle 10.2.0.3.0 enterprise rdbms.
Windows 2003 Server platform.
The extern.c file is used as is.
I do not have a c compiler that understands the (undocumented) command options in make.bat
I have several different c compilers that I've compiled it with.
I produced an extern.dll file and placed it in my oracle home\bin directory.
I used the sample extern.sql file as is (except for updating the create library command to point to the correct directory. I typed it correctly and I know it's finding the file, because it locks the file after I try to access the function in it via its pl/sql wrapper function.
I modified listener.ora to look like this. I've used ENVS = and ENV = (seen mention of both spellings in the docs I've read). Bounced the box after changing the listener.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\OraHome_1)
(ENVS = "EXTPROC_DLLS=ANY")
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = hsodbc)
(ORACLE_HOME = D:\OraHome_1)
(PROGRAM = hsodbc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))
)
)
When I run the sample program that comes to test it, I get this:
SQL> set serveroutput on;
SQL> execute UseIt;
BEGIN UseIt; END;
*
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: Unable to load symbol from DLL
ORA-06512: at "SYSTEM.PLS_MAX", line 1
ORA-06512: at "SYSTEM.USEIT", line 8
ORA-06512: at line 1