創建的 library
createorreplacelibraryMYLIB
as'D:installedoracleora92bintest1.dll';
dll 中定義了一個方法 int fnTest1(void) 返回一個數字
函數
CREATEORREPLACEFUNCTIONmytest1RETURNDOUBLEPRECISIONAS
LANGUAGECNAME"fnTest1"
LIBRARYMYLIB
PARAMETERS(RETURNDOUBLE);
說明:
ORA-28575:unabletoopenRPCconnectiontoexternalprocedureagent
解決:
1.tnsnames.ora需要配置EXTPROC_CONNECTION_DATA
EXTPROC_CONNECTION_DATA=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0))
(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))
)
(CONNECT_DATA=
(SID=PLSExtProc)
(PRESENTATION=RO)
)
(CONNECT_DATA=
(SID=ora10g)
(PRESENTATION=RO)
)
)
2. listener.ora 需要配置 (PROGRAM = extproc)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=PLSExtProc)
(ORACLE_HOME=D:oracleproduct10.2.0db_1)
(PROGRAM=extproc)
)
(SID_DESC=
(SID_NAME=ora10g)
(ORACLE_HOME=D:oracleproduct10.2.0db_1)
)
)
ORA6521PL/SQL:Errormappingfunction
解決:
Note:297906.1
Cause
UsageofC++file(*.cpp)insteadofCfile(*.c)assourceforbuildingtheDLL
Thelibrarygeneratedcontainsthefunctionwiththedecoratednamewhichismangledbydefault
Solution
Toimplementthesolution,pleaseusethefollowingcodeforthe*.cppcode:
#ifdef__cplusplus
extern"C"{
#endif
int__declspec(dllexport)square_of(intx)
{
return(x*x);
}
#ifdef__cplusplus
}
#endif