Creating so for executing external procedure(HP ANSI C)", version 8.1.15
Hi,
I am using HP-UX 11.0,Oracle 8.1.15(server) and HP ansi C A.11.01.20 language.
My goal is calling 'c' routine thru stored procedure.
My program "outputString.c" is :
#include <stdio.h>
void outputString(
char *path,
char *message)
FILE *file_handle;
file_handle = fopen(path, "w");
fprintf(file_handle, "%s\n", message);
fclose(file_handle);
My question is How compile "outputString.c" with HP ansi C (cc -XX -XX -XX... output.so outputString.c)??
Hi,
I am using HP-UX 11.0,Oracle 8.1.15(server) and HP ansi C A.11.01.20 language.
My goal is calling 'c' routine thru stored procedure.
My program "outputString.c" is :
#include <stdio.h>
void outputString(
char *path,
char *message)
FILE *file_handle;
file_handle = fopen(path, "w");
fprintf(file_handle, "%s\n", message);
fclose(file_handle);
My question is How compile "outputString.c" with HP ansi C (cc -XX -XX -XX... output.so outputString.c)??
Similar Messages
-
Using an AIX archive file as a library for an external procedure.
I cannot use an archive file, created with the ar command, that contains a shared object that was created with the xlc and ld commands as a library for external procedures. I can use the shared object file created with the ld command as a library for an external procedure. Why would I encounter an invalid magic number and what is the resolution?
Example:
oracle:@husk21:/home/oracle> ksh -x ./Oracle_demo.ksh
+ rm shell.o shell.so shell.so.exp shell.so.imp
+ make -f /u01/oracle/product/11.1.0.7/db/rdbms/demo/demo_rdbms32.mk extproc_no_context SHARED_LIBNAME=shell.so OBJS=shell.o
/u01/oracle/product/11.1.0.7/db/bin/oraxlc -q32 -c -I/u01/oracle/product/11.1.0.7/db/rdbms/demo -I/u01/oracle/product/11.1.0.7/db/rdbms/public -I/u01/oracle/product/11.1.0.7/db/plsql/public -I/u01/oracle/product/11.1.0.7/db/network/public -I/u01/oracle/product/11.1.0.7/db/precomp/public shell.c
generate_export_list() { /bin/nm -X32_64 -B -h -g "$1" | grep -v ' U ' | awk '{print $3}' | egrep -v '^\.|^TOC' | sort | uniq ; }; generate_import_list() { LIB_NAME=$1; IMP_FILE=$2; cat /u01/oracle/product/11.1.0.7/db/rdbms/lib/xa.imp | head -1 | awk '{print $0, "." }' > ${IMP_FILE}; /bin/nm -X32_64 -C -B -h -g ${LIB_NAME} | grep ' U ' | grep -v "::" | grep -v "(" | grep -v "\.cc" | awk '{print $3}' | sed -e "s/\.//g" | grep -v "^_" >> ${IMP_FILE}; }; generate_import_list shell.o shell.so.imp; generate_export_list shell.o > shell.so.exp; /bin/ld -b32 -bnoentry -bM:SRE -bE:shell.so.exp -bI:shell.so.imp -o shell.so shell.o -L/u01/oracle/product/11.1.0.7/db/lib -lc_r -lm
ld: 0711-224 WARNING: Duplicate symbol: .system
ld: 0711-224 WARNING: Duplicate symbol: system
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
oracle:@husk21:/home/oracle> ar rv libshell.a shell.so
ar: Creating an archive file libshell.a.
a - shell.so
oracle:@husk21:/home/oracle> ar tv libshell.a
rwxr-xr-x 3514/3516 1263 Sep 08 10:00 2009 shell.so
oracle:@husk21:/home/oracle> file shell.so
shell.so: executable (RISC System/6000) or object module not stripped
oracle:@husk21:/home/oracle> file libshell.a
libshell.a: archive (big format)
SQL> CREATE OR REPLACE LIBRARY shell_lib is '/home/oracle/libshell.a';
/ 2
Library created.
SQL> CREATE OR REPLACE PROCEDURE shell(command IN char)
AS EXTERNAL
NAME "shell"
LIBRARY shell_lib
LANGUAGE C
PARAMETERS (command string);
/ 2 3 4 5 6 7
Procedure created.
SQL> exec shell('ls');
BEGIN shell('ls'); END;
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: 0509-022 Cannot load module /home/oracle/libshell.a.
0509-103 The module has an invalid magic number.
ORA-06512: at "V500.SHELL", line 1
ORA-06512: at line 1
SQL> CREATE OR REPLACE LIBRARY shell_lib is '/home/oracle/shell.so';
2 /
Library created.
SQL> exec shell('ls');
PL/SQL procedure successfully completedUsing an AIX archive file as a library for an external procedure.
-
Using Fault handling framework for executing Database procedure
We have a requirement wereby we have API to be executed on Oracle DB which would return a code saying 0 or 1.
I meaning error.
Now with regards to exception handling we require that we receive remote fault we retry for 3 times & if not successful have a email sent out & a human intervention.
This can be easily taken care by having define this in Fault polciy.xml
Another requirement is when the API fails for some reason & we get returncode as 1.Now we would like ot invoke the same policy for this type of error.Although BPEL instance is not failed.But we can throw custom fault.
Now the APi's that we have can be called in 3 ways.
1.In each instance we call API exactly once
2.In each instance we call API in a loop for each record in message.Hence if 10 records are there in message & while executin 7th time it failed then how to handle reminaing records?
3.In each instance we call API only once but submit all 10 reocrds at once.And at same time 7th record fails then whats best way to handle this?
We realy want to use fault handling mechanism because it gives a lot of options of replay rethroew continue...but given the requirement can somebody point out a right way of using fault policy?
ThanksU can archive the records in archive tables once the database adapter polls the data.
-Ramana. -
Creating Tcode for report painter program in 4.0B version?
hi all,
How to create a tcode for report painter program in 4.0 B?
I searched the forums. but i couldn't find the same for 4.0 B?
Please helo me to solve this?
Thanks,
VamshiI am closing as no one answered and worked in alaternative way for the requirement.
-
Not able to create Oracle External Procedure to Run Host Commands
Trying to follow this article
http://timarcher.com/node/9
Its related to
Oracle External Procedure to Run Host Commands
steps
1)mkdir –p /u01/app/usfapp/oracle_external_procs/oracle_host
2)
Author is suggesting to create a file
but header file is missing in very first line... may be not sure..say it is <stdio.h>Create a file named oracle_host.c. The contents of this file will be:
#include
int RunCmd(char *cmd)
return(system(cmd));
4) Create the file named makefile. The contents of this file will be:
oracle_host: oracle_host.o
gcc -shared -o oracle_host.so oracle_host.o
$ cat makefile
oracle_host: oracle_host.o
gcc -shared -o oracle_host.so oracle_host.o
5)
Now run the command make
The output on my server looks like:
[u01/app/usfapp/oracle_external_procs/oracle_host]
banner@usfbannerte [TRNG] > make
gcc -shared -o oracle_host.so oracle_host.o
here I stuck .. Not able to run this step ]$ make
gcc -shared -o oracle_host.so oracle_host.o
/usr/bin/ld: oracle_host.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
oracle_host.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [oracle_host] Error 1
Any one has any idea what went wrong
Any other link related to this is most welcomed.
Please suggest ...hi
please update
or
provide any other link / document for
Oracle External Procedure to Run Host Commands
--using c
Thanks in advance. -
ORA-06520 when External Procedure run.
I need to run a C application that will run an external procedure and I am getting the following errors reported when I run the function call in PL/SQL.
The test program follows
declare
rn number;
begin
rn:=wpleca('CUSTCODE PASSTEST');
END;
The error that is generated is
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: ld.so.1: extproc: fatal: libgcc_s.so.1: open failed: No such file or directory
ORA-06512: at "CUSTOM.WPLECA", line 0
ORA-06512: at line 4
The C program follows
#include<stdio.h>
#include<stdlib.h>
int sysrun(char *command) {
int num;
char str[80];
strcpy (str, "/xxxx/test/adhoc/syscr/wpleca2unix.sh ");
strcpy (str,command);
num = system(str);
return num;
The C compile commands follow
gcc -fPIC -c wpleca.c
gcc -shared -o libwpleca.so wpleca.o
The create library command follows
CREATE OR REPLACE LIBRARY PLECA_LIB
AS '/xxxx/test/adhoc/syscr/libwpleca.so'
The create function call follows
CREATE OR REPLACE FUNCTION wpleca (params_in in varchar2)
return binary_integer
as language C
name "sysrun"
library pleca_lib
parameters(params_in string);
The shared library and the script both exist with approporate permissions
-rwxr-xr-x 1 root other 5800 Feb 27 14:12 /xxxx/test/adhoc/syscr/libwpleca.so
-rwxrwxr-x 1 xyz test 1139 Feb 27 14:14 /xxxx/test/adhoc/syscr/wpleca2unix.sh
Any help with this error would be most appreciated.We are getting the error, Has anyone faced this issue, appreciate your help in advance.
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: ld.so.1: extproc: fatal: /tmp/utils.so: wrong ELF class: ELFCLASS32
while trying to call the external C program
Steps done for calling external procedure
1. Insert entries in the tnsnames.ora and listner.ora at oracle server location
Tnsnames.ora
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = extproc_key))
(CONNECT_DATA = (SID = extproc))
Listner.ora
CALLOUT_LISTENER =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = IPC)
(KEY = extproc_key)
SID_LIST_CALLOUT_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = extproc)
(ORACLE_HOME = /opt/oradba92/OraHome)
(PROGRAM = extproc)
(ENVS="EXTPROC_DLLS=ANY")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ctsinpunsun10)(PORT = 1523))
2. restart the listener external service
3. create library using create library c_utils as ‘/tmp/c_utils.so’
4. create sample c program on /tmp location as test.c
5. compile c program on unix using cc test.c command
For compile c program
$ cc –c util.c command
Create object file
$cc –G –c util.c
Create .so file
$ld –r –o utils.so util.o
6. create object file of above c program using cc –G –c test.c , this command will create new object file as test.o
7. after creating the object file , create dynamic link using
ld –r –o utils.so test.o
8. Give the permission to utils.so as 775
Add “/tmp” path in LD_LIBRARY_PATH
9. using sqlplus execute the command “SELECT Plscallscdivisor_Func FROM dual” it will gives error as
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: ld.so.1: extproc: fatal: /tmp/utils.so: wrong ELF class: ELFCLASS32
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
Message was edited by:
user573236 -
Make EXE for Pl/sql procedure
Hi all,
I have one Pl/sql procedure for which i want make EXE.
can we make EXE files for PL/sql procedures using ' Oracle Developer Tools for Visual Studio .NET'
Thank you.Hi Al,
Can you tell me in steps how to create EXE for pl/sql procedure using C# console application.
I have one webservice link which i want to invoke and i have to put the webservice output in a saparate file.
I wrote Pl/sql procedure which invokes/consumes the webservice using UTL_HTTP and also placed the output of Webservice in a saparate file using UTL_FILE.
But i have to execute this procedure on a Workstation where there is No Oracle installed.
as you suggested using C# console application. Will this Procedure with UTL_FILE & UTL_HTTP packages run in that c# console application.
Thank you -
Lost RPC Connection to external procedure agent....
Hi,
I have a sample.dll fil & i have created a library by the following command...
create or replace library trend_lib as 'C:\oracle\product\10.2.0\db_1\BIN\sample.dll';
'C:\oracle\product\10.2.0\db_1\BIN\sample.dll';------------this is the location where i keep the sample.dll file .
Then i have created a package
create or replace PACKAGE p1
as
FUNCTION trend( inp IN BINARY_INTEGER) return BINARY_INTEGER as
LANGUAGE C
LIBRARY trend_lib
name "polynomial"
PARAMETERS (inp INT);
end;
But when i am trying to execute the following query it shows the errror:::
SQL> select p1.trend(6) from dual;
select p1.trend(6) from dual
ERROR at line 1:
ORA-28576: lost RPC connection to external procedure agent......
mine tnsnames.ora file configuration is :
FIN11G_172.30.0.12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.30.0.12)(PORT = 1522))
(CONNECT_DATA =
(SID = fin11g)
(SERVER = DEDICATED)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
ALMDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.30.3.11)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = almdb)
RSBI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.30.0.12)(PORT = 1521))
(CONNECT_DATA =
(SID = rsbi)
(SERVER = DEDICATED)
And listener.ora file is....
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ANY")
(SID_DESC =
(GLOBAL_DBNAME = ALMDB)
(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
(SID_NAME = ALMDB)
(ENVS = "EXTPROC_DLLS=ANY")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 01hw177387.fns.com.au)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)Hi;
please see below:
ORA-28576 When Executing External Procedure [ID 295721.1]
ORA-28576 Using External Procedures [ID 113179.1]
External Procedure Fails With ORA-28576 [ID 468404.1]
Also see:
Problem calling dll using extproc
Regard
Helios -
"Create quotation for order" is not allowed (ORD 80000119 )
Hi,
After creation of service order I want to create quotation then system gives error massage as below,
"Create quotation for order" is not allowed (ORD 80000119 )
Message no. BS002
Diagnosis
The transaction 'Create quotation for order' is not allowed for ORD 80000119, because no status is set to permit it.
System response
You cannot carry out the transaction 'Create quotation for order'.
Procedure
You can carry out this transaction if you set a user status, which permits 'Create quotation for order'.
Thanks & Regards
kapilKapil,
Check the System status and user status of the order. Quotation can be created only before releasing the order (REL). or Any user status that may prevent creation of Quotation.
Babu -
Is there a way to execute a procedure referenced in an XML string?
The XML string can contain a stand-alone procedure/function or one within a package. The procedure/functions themselves may contain any number of inputs or outputs for procedures. I'm not sure how the procedure that will process this XML string will "know" the datatypes for the IN/OUT parameters for any given stored program. Does Oracle have any built-in mechanism that will execute stored procs in an XML, or would I have to write something that loops through the XML, extracting the proc names, parameters, and parameter values, then query the data dictionary for what type of OUT parameter data type should be used?
I am told that SQL*Server is able to execute procs reference in XML, so I'm assuming Oracle must have some sort of API to use as a gateway for executing a procedure.Hi ,
Open your edgeProject/index_edgeActions.js.Replace the following with single line comment. Open in edge animate 2014 and publish again. Published content will work
/*================================================================================
change Q number to match breakers || Q should = breakers +1 to account for 0 value if no BK0 exists
| |
| |
| | DOUBLE CHECK BECAUSE OF BK0
| |
| |
| |
__| |__
================================================================================*/
Like this.
//================================================================================
//change Q number to match breakers || Q should = breakers +1 to account for 0 value if no BK0 exists
// | |
// | |
// | | DOUBLE CHECK BECAUSE OF BK0
// | |
// | |
// | |
// __| |__
//================================================================================ -
Is the source code for the external procedures included with Oracle available? I'm looking for the C code that is called by dbms_lock and dbms_pipe. The pipe code file is called kxpp.c
If these files are available, where can I find them?
Thanks!
1nsan0
nullIs your listener started. This error normally comes when the listener is not started.
From cmd prompt try this
cmd> lsnrctl stat
if you get this error
LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 - Production on 24-AUG-2001 16:49:46
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=incq127e)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 61: Unknown error
that means listerner is not started.
from cmd prompt or from control panel services run this command
cmd> lsnrctl start
and then try the tnsping utilit -
Getting "ORA-28576: lost RPC connection to external procedure agent" for R scripts.
Hello,
I am trying R integration with OBIEE. As part of this, I have created a simple R script for a scatter plot. Below is the R script
begin
sys.rqScriptCreate('randomRedDots',
'function()
res <- 1:10
plot(1:100, rnorm(100), pch=21, bg="red", cex=2)
res
end;
I am testing this script in SQL Developer by executing the below sql:
select image
from table(rqEval(NULL,
'PNG',
'randomRedDots')
During these tests, very often, I get ORA-28576 error when I run the SQL. The complete error is:
ORA-28576: lost RPC connection to external procedure agent
ORA-06512: at "RQSYS.RQEVALIMPL", line 77
ORA-06512: at "RQSYS.RQEVALIMPL", line 74
28576. 00000 - "lost RPC connection to external procedure agent"
*Cause: A fatal error occurred in either an RPC network connection,
the extproc agent, or the invoked 3GL after communication had
been established successfully.
*Action: First check the 3GL code you are invoking; the most likely
cause of this error is abnormal termination of the
invoked "C" routine. If this is not the case, check for
network problems. Correct the problem if you find it. If all
components appear to be normal but the problem persists, the
problem could be an internal logic error in the RPC transfer
code. Contact your customer support representative.
However, if I re-run the SQL, I do not get this message. This happens at random.
Any pointers to why this error occurs?
Thanks,
AbhishekAbhishek,
Please look for a core file in $ORACLE_HOME/hs/log and look for errors in the call stack associated with the core file.
Examining the errors will help identify the cause of the intermittent ORA-29576 error.
Thank you,
Sherry -
How do I create a new Itunes account for my external HD?
Hi. I am a graduate student with a huge amount of music files for academia. I store the academia music files on my external HD, since it will just take up too much space on my computer. I wanted to create a separate Itunes account just for my external HD music files. How do I go about doing this? I tried to set it up and created a new account, but it automatically synced to my computer Itunes and I ended up deleting all of my personal music, video and reading articles on my personal itunes account.
As a graduate student you will quickly learn the importance of exact terminology. I presume your colleague told you to copy the "iTunes folder". You can't copy just iTunes (well, you can, but it isn't easy). Saying "iTunes" on its own refers to the application itself, not the library.
You do not need to make a new account. This again gets confusing unless you tell us exactly what you did. As I said before, an "iTunes account" is something you log into to make a purchase from the iTunes Store. A "computer account" is a whole new user area on your computer and isn't made on a different hard drive. An "iTunes library" is a collection of files and folders that generate the window you see when you start the iTunes application.
I do not know how you are ending up with two icons on the dock. While it is possible to do that it isn't at all normal unless you somehow are running two copies of iTunes at the same time. That is exceedingly difficult to do and people have unsuccessfully tried and would like to know how you did it.
You can have two independent libraries and there won't be any crosssover from one to the other. I have four on my computer. Use the procedure I outlined earlier to create a second library and to switch between them.
I was a graduate student many years ago and one of the first things I learned to do so I didn't lose years of research was to make multiple backup copies of anything I generated by computer, especially before performing any major changes to the computer such as installing new software or substantial file rearrangement. I kept several copies in different buildings on campus and a copy at home in another part of town just in case the campus was wiped out by a disaster. -
External procedure call for cobol programs
I'm trying to call cobol programs using external procedure calls. I followed metalink doc#119543.1 but when the cobol shared library is called from PL/SQL, the session hangs. I'm running Oracle 9.2.0.4 EE, Microfocus Server Express 2.2, C for AIX v6, and AIX 5.2 (64-bit). If you know how to get this working or you have a working test case, please post a reply. Thanks.
You know that there are several steps to it :
1.- Make a library from cobol a the source code in a file
2.- Check the listener parameters to call external procedures and the service in the client
3.- Make a library inside the database
4.- Create the procedure that is going to call the
procedure.
Did you do those steps?
Joel P�rez -
Execute any procedure for developers
Hello,
our developers want the privilege "execute any procedure" because the self-programmed application needs execute on unknown procedures. (Oracle 10.2) It's the application-administrator-user on which the development has full access.
On AskTom I read, that "execute any procedure" is extremely powerful an should not be granted to normal users.
I would like to know, if this is only not recommended for O7_DICTIONARY_ACCESSIBILITY=true or under any circumstances.
Any ideas how we can find out, which procedures are used by this user? Or on the other hand, which are the risky elements from "execute any procedure"?
Any arguments against giving this privilege are welcome, I have to give a statement on this.
Thanks,
M.HannibalOk. I just browsed through Asktom for this issue and it is true that there are NO risks highlighted over there after granting "EXECUTE ANY PROCEDURE" to a user.
Though, I would like to put forth following points.
1. Some of procedures/functions in SYS as not supposed to be used by the normal database users (results can be unpredictable)
2. Upon grant of this privilege, the user can execute procedure of any schema in the database. This can be problematic if an user of PAYROLL schema starts executing procedures of FINANCE schema and change all accounts (kind of) related information.
In your situation, you can handle this by creating a DDL trigger in the schema where the procedure will be created. Via trigger, grant execute on this procedure to the user under which the application is going to run.
Thus you will have control over the procedure execution and you can easily track down the problem if somehting goes wrong (as will then you know who all can execute a particular procedure).
Maybe you are looking for
-
Safari repeatedly crashes after a few seconds
Hi I have a new install of Safari (6.0.5) in a fresh install of OSX (10.8.5) on a new MBP 2.9 GHz i7 8GB e.g it's completely virgin and new It (Safari) repeatedly crashes after just a couple of seconds though. Would a clean install of Safari solve th
-
How to avoid "The application requires an earlier version of Java. "?
Hello, I deployed a Java applet built like this javac -source 1.4 -target 1.4 foobar.javaThe reason why I do it this way, is that many public libraries, have computers that only have Java 1.4 installed (and I found one case with 1.3 but decided not t
-
Problem with "date -d" function in bash script. Leopard bug?
I have this really nice rsync bash script that I use to make rotating snapshot backups of my different Ubuntu servers to a single backup server. I am now trying to use this same script on my Leopard machine, but it seems to have a serious problem wit
-
How I can set the spelling language in Pages for iPad?
how I can set the spelling language in Pages for iPad? may for german...
-
How do i wipe all the files and information on my macbook air?
how do i wipe all the files and information on my macbook air?