ramlakshman
Technical User
Hi,
I have created the following mq.c
#include <stdio.h>
#include <cmqc.h>
void ConnectQ(PMQCHAR QmgrName,PMQHCONN Qhandle,PMQLONG Comp,PMQLONG Reason)
{
PMQCHAR Qmgrname;
strcpy(Qmgrname,QmgrName);
MQCONN(Qmgrname,Qhandle,Comp,Reason);
}
void DisconnectQ(PMQHCONN Qhandle,PMQLONG Comp,PMQLONG Reason)
{
MQDISC(Qhandle,Comp,Reason);
}
which is a wrapper function for MQSERIES
then I compiled like this
uidpwd=/
cc -Ae +z +DAportable -I/ram/mqseries -c mq.c -o mq.o -lmqm -L$ORACLE_HOME/lib/ -lclntsh `cat $ORACLE_HOME/lib/sysliblist` -lsql8
ld +s -b -o mq.so mq.o -L/usr/lib -L$ORACLE_HOME/lib/ -lclntsh `cat $ORACLE_HOME
/lib/sysliblist` -lsql8 -L/rrtsreg1/bin
My directory is having the full permission for the oracle user
This is my library
CREATE OR REPLACE LIBRARY mqora IS '/ram/mqseries/mq.so';
This is my procedure
CREATE OR REPLACE PROCEDURE ConnectQ(QMgrName IN varCHAR2,
Qhandle OUT binary_integer,
CompCode OUT binary_integer,
ReasonCode OUT binary_integer)
IS EXTERNAL
NAME "ConnectQ"
LIBRARY mqora
PARAMETERS (QMgrName BY REFERENCE,
Qhandle ,
CompCode ,
ReasonCode );
CREATE OR REPLACE PROCEDURE DisconnectQ(Qhandle IN binary_integer,
CompCode OUT binary_integer,
ReasonCode OUT binary_integer)
IS EXTERNAL
NAME "DisconnectQ"
LIBRARY mqora
PARAMETERS (Qhandle BY REFERENCE LONG,
CompCode ,
ReasonCode );
Now I am calling the function
set serveroutput on size 10000;
set linesize 256;
define csize=500
set verify off
declare
Qmgr char(48) := 'TEST.DV';
Qname char(48) := 'TEST.LISTEN';
hConn binary_integer;
CompCode binary_integer;
Reason binary_integer;
begin
ConnectQ(Qmgr,hConn,CompCode,Reason);
dbms_output.put_line('MQCONN: CompCode='||CompCode||' Reason='||Reason||hConn);
DisconnectQ(hConn,CompCode,Reason);
dbms_output.put_line('MQDISC: CompCode='||CompCode||' Reason='||Reason);
end;
I am getting the following error
declare
*
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: I/O error
ORA-06512: at "OPS$PVCSLBR1.CONNECTQ", line 0
ORA-06512: at line 8
I don't now where I made the mistake.
If any one has already wrore a wrapper function please help me .
TIA
I have created the following mq.c
#include <stdio.h>
#include <cmqc.h>
void ConnectQ(PMQCHAR QmgrName,PMQHCONN Qhandle,PMQLONG Comp,PMQLONG Reason)
{
PMQCHAR Qmgrname;
strcpy(Qmgrname,QmgrName);
MQCONN(Qmgrname,Qhandle,Comp,Reason);
}
void DisconnectQ(PMQHCONN Qhandle,PMQLONG Comp,PMQLONG Reason)
{
MQDISC(Qhandle,Comp,Reason);
}
which is a wrapper function for MQSERIES
then I compiled like this
uidpwd=/
cc -Ae +z +DAportable -I/ram/mqseries -c mq.c -o mq.o -lmqm -L$ORACLE_HOME/lib/ -lclntsh `cat $ORACLE_HOME/lib/sysliblist` -lsql8
ld +s -b -o mq.so mq.o -L/usr/lib -L$ORACLE_HOME/lib/ -lclntsh `cat $ORACLE_HOME
/lib/sysliblist` -lsql8 -L/rrtsreg1/bin
My directory is having the full permission for the oracle user
This is my library
CREATE OR REPLACE LIBRARY mqora IS '/ram/mqseries/mq.so';
This is my procedure
CREATE OR REPLACE PROCEDURE ConnectQ(QMgrName IN varCHAR2,
Qhandle OUT binary_integer,
CompCode OUT binary_integer,
ReasonCode OUT binary_integer)
IS EXTERNAL
NAME "ConnectQ"
LIBRARY mqora
PARAMETERS (QMgrName BY REFERENCE,
Qhandle ,
CompCode ,
ReasonCode );
CREATE OR REPLACE PROCEDURE DisconnectQ(Qhandle IN binary_integer,
CompCode OUT binary_integer,
ReasonCode OUT binary_integer)
IS EXTERNAL
NAME "DisconnectQ"
LIBRARY mqora
PARAMETERS (Qhandle BY REFERENCE LONG,
CompCode ,
ReasonCode );
Now I am calling the function
set serveroutput on size 10000;
set linesize 256;
define csize=500
set verify off
declare
Qmgr char(48) := 'TEST.DV';
Qname char(48) := 'TEST.LISTEN';
hConn binary_integer;
CompCode binary_integer;
Reason binary_integer;
begin
ConnectQ(Qmgr,hConn,CompCode,Reason);
dbms_output.put_line('MQCONN: CompCode='||CompCode||' Reason='||Reason||hConn);
DisconnectQ(hConn,CompCode,Reason);
dbms_output.put_line('MQDISC: CompCode='||CompCode||' Reason='||Reason);
end;
I am getting the following error
declare
*
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: I/O error
ORA-06512: at "OPS$PVCSLBR1.CONNECTQ", line 0
ORA-06512: at line 8
I don't now where I made the mistake.
If any one has already wrore a wrapper function please help me .
TIA