Calling DTS package from Stored Procedure
I am getting error calling DTS package from CF.
So i want to call DTS package from SQL Server Stored
Procedure.
DTS package create text file. So no need of input or output
parameter.
What is the syntax?.
thanks for ur help.
Ted Kruger explains how this can be done in his blog post
Run SSIS Package from Stored Procedure
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
Similar Messages
-
Calling SSIS package in Stored Procedure...
I have a SSIS package, and i want to call this (run this SSIS package) from Stored Procedure in Sql Server 2008.
Can anyone please explain to me as to how can i call SSIS package from SP?
Thanks!
RahmanTed Kruger explains how this can be done in his blog post
Run SSIS Package from Stored Procedure
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Problem with execute SSIS package from stored procedure
Hi,
I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
how to access SSIS catalog (one of them by Ke Yang -
http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
How to debug this issue?
Any suggestion?
Thanks
SQL Server 2014 BISSMS does not propagate user credentials thus the error
Arthur
MyBlog
Twitter -
Calling Java Methods from Stored Procedures
Can I call Java Methods from Oracle Stored Procedures? I have a Java framework that logs events and would like to reuse it for logging events that occur in stored procedures.
nullYou need to publish java class methods to plsql.
Attached below is some information.
Although both PL/SQL modules and Java classes are stored in the database
and are managed by many of the same mechanisms, each of them resides in
its own namespace. Therefore, Java methods are not accessible from SQL
and PL/SQL by default. In order to expose Java methods to the SQL and
PL/SQL engines, first publish that Java method to the SQL namespace using
a 'Call Spec'.
Note: A 'Call Spec' does not create an additional layer of
execution so there is no performance penalty incurred.
A 'Call Spec' is simply a syntactical mechanism used to
make a method known in the SQL namespace.
The SQL name established by the 'Call Spec' can be top-level or packaged.
The syntax differs only slightly and is consistent with that used for
PL/SQL procedures and packages. For more information on the exact
syntax, see the references listed in 'Related Topics'.
In general, a top-level procedure 'Call Spec' takes the form:
CREATE OR REPLACE PROCEDURE procname ( pname mode ptype, ... )
AS LANGUAGE JAVA NAME 'javaname ( javatype, ... )';
Where: procname is the SQL name you wish to publish
pname is the name for a parameter to procname
mode is the parameter mode (i.e. IN, OUT, IN OUT)
ptype is a valid SQL type (e.g. NUMBER, CHAR, etc.)
javaname is the fully qualified name of the Java method
javatype is a Java type for the corresponding parameter
Likewise, a top-level function 'Call Spec' takes the form:
CREATE OR REPLACE FUNCTION fname ( pname mode ptype, ... ) RETURN rtype
AS LANGUAGE JAVA NAME 'javaname ( javatype, ... ) return javatype';
Where: fname is the SQL name you wish to publish
rtype is the SQL return type of the function
Note: Within the NAME clause, everything within quotes is case
sensitive. For example, if the keyword 'return' is in all
CAPS, this Call Spec will not compile.
Other optional parts of this syntax have been omitted here for simplicity.
Additional examples in subsequent sections illustrate some of these options.
eg
CREATE PROCEDURE MyProc (rowcnt IN NUMBER, numrows OUT NUMBER)
AS LANGUAGE JAVA NAME 'MyClass.MyMethod(int, int[])';
There are several important things to note here:
1.) The 'Call Spec' for a JSP must be created in the same schema as the
corresponding Java class that implements that method.
2.) IN parameters are passed by value. This is the only parameter mode
available in Java. OUT parameters, therefore, must be passed as single
element arrays in order to emulate pass by reference.
3.) Parameter names do not need to match, but the number and types of
the parameters must match (with just one exception - see item 5 below).
Oracle 8i supports conversions between an assortment of SQL and Java.
See the references listed in 'Related Topics' for additional information.
4.) Primitive types (e.g. int, float, etc.) are not required to be fully
qualified with any package name. However, standard Java object types
(e.g. String, Integer, etc.) as well as any user defined object types
(e.g. like those generated by JPublisher) must be prefixed with a
corresponding package name (e.g. java.lang) if applicable.
5.) The 'main' method which takes a single String[] parameter can be
mapped to any PL/SQL procedure or function which takes some number
of VARCHAR2 or CHAR type IN parameters. For example, the java method:
public static void main ( String[] args ) { ... }
can be mapped to each of the following:
PROCEDURE MyProc2 ( arg1 IN CHAR ) ...
PROCEDURE MyProc3 ( arg1 IN CHAR, arg2 IN VARCHAR2 ) ...
PROCEDURE MyProc4 ( arg1 IN VARCHAR2, arg2 IN VARCHAR2 ) ...
and so forth. Parameters map to the corresponding element of the String
array (e.g. arg1 -> args[0], arg2 -> args[1], etc.).
null -
How to call 'C' programs from stored procedures?
Hi
Did anybody tried to call 'C' programs
from oracle stored procedures?
If anybody knows, can you please send
how to configure the listener.ora and
tnsnames.ora. If its possible post all the
information from the begining with examples.
thanks....Oracle JDBC did not support return a result set, if you are using Oracle 9i, you can use pipeline function, then using the TABLE() function the get the row.
Good Luck.
Welcome to http://www.anysql.net/en/ -
Calling shell script from stored procedure.
Hi Everybody,
Could anyone tell me how to call a shell script from a stored procedure.
Thanks,
VasuYou would need to write a Java stored procedure that calls out to the underlying operating system. Tom Kyte has an example of this here
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:952229840241
Make sure that you're very aware of the security implications here, however. Your commands will run as the Oracle user on the host operating system, which makes it possible that a coding error and/or an attacker could do something like delete or corrupt Oracle data files, so you'll probably want to harden the code substantially.
Justin -
Can we able to call .bat file from Stored procedure?
My actual requirement is to import an csv file(where it contains a table) into oracle Database from the front end screen when the csv file location is given.
Where in the screen (designed by dotnet) a browse option will be present and I will give the csv file location and this will be passed into stored procedure as an input parameter.
Now I need a stored Procedure that can Import my csv file table data into Oracle database10g.
I shoudnot use the import option present in the physical Oracle Database.
Can any one please provide me the stored Procedure?NGK246 wrote:
My actual requirement is to import an csv file(where it contains a table) into oracle Database from the front end screen when the csv file location is given.
Where in the screen (designed by dotnet) a browse option will be present and I will give the csv file location and this will be passed into stored procedure as an input parameter.
Now I need a stored Procedure that can Import my csv file table data into Oracle database10g.You do not seem to understand the basic concept of client-server. If you supply a file location for the server code, and that location is not on the server, how do you expect the server to access that file in that location?
You cannot expect the server to hacks its way across the network, crack open a remote file system somewhere, and steal that file from that location.
As the client has access to that location and file, the client needs to read that file and supply that file's content to the server. This is how the server receives a file from a client. With Oracle. With FTP. With SCP. With SFTP. With HTTP. With SMTP and file attachments to e-mails. Etc.
This is not specific to Oracle. This is a fundamental concept. So the problem here is your ignorance of client-server and not a problem with Oracle and not a problem with PL/SQL.
I shoudnot use the import option present in the physical Oracle Database.Not sure what this mean, but the basic statement that "+we should not use feature 123 or feature ABC of Oracle+", is invariable an utterly idiotic statement to make. Kind of like buying a car and then making the statement that groceries may not be put into the truck as the car's trunk should not be used.
Can any one please provide me the stored Procedure?Very arrogant of you to assume that others will spend their free time writing code for you - with you copying-and-pasting that code and providing it to your employers, as your work... -
SpRunDTS for calling DTS package from sp
CREATE PROCEDURE spRunDTS
@PKGName varchar(500),
@PckPwd varchar(100),
@OMessage varchar(2000) OUTPUT
As
--Declaring the variables for the DTS Package
Declare @hr int,
@oPKG int ,
@Server_Name varchar(200),
@Cmd varchar(1000),
@Server_Uname varchar(100),
@Server_Pwd varchar(100),
@PackagePwd varchar(100),
@PackageName varchar(500)
--- Setting the credentials
set @Server_Uname ='cpvar_dev'
set @Server_Pwd ='Stamford18'
set @PackagePwd = ltrim(rtrim(@PckPwd))
set @OMessage='Success'
--- Creating the DTS Package object
EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUT
IF @hr <> 0
BEGIN
set @OMessage = '*** Create Package object failed'
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
select @Server_Name = ltrim(rtrim(@@servername))
set @PackageName=ltrim(rtrim(@PKGName))
SET @Cmd = 'LoadFromSQLServer("'+@Server_Name +'", "'+@Server_Uname+'", "'+@Server_Pwd+'", 256, "' + @PackagePwd +'", , , "'+@PackageName+'")'
print @Cmd
EXEC @hr = sp_OAMethod @oPKG, @Cmd, NULL
IF @hr <> 0
BEGIN
set @OMessage = '*** Load Package failed ' + @PKGName
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
--Executing the Package:
EXEC @hr = sp_OAMethod @oPKG, 'Execute'
IF @hr <> 0
BEGIN
set @OMessage = '*** Execute failed'
EXEC @hr = sp_OADestroy @oPKG
RETURN
END
--Cleaning up:
EXEC @hr = sp_OADestroy @oPKG
IF @hr <> 0
BEGIN
set @OMessage = '*** Destroy Package failed'
RETURN
ENDThanks for sharing.
-
Call Oracle function from Stored Procedure
Hi,
I have function Which returning one number. I want to use that number in a procedure. How to call the Oracle Function from the Procedure
Create procedure
AS
Begin
Check number;
Select Function1 into check from dual;
It is giving error.
Can anyone provide me example for this.
Thanks in advancePut the Check Number; before begin
SQL> create or replace procedure abc as
2 begin
3 val number;
4 select abcd into val from dual;
5 dbms_output.put_line(val);
6 end;
7 /
Warning: Procedure created with compilation errors.
Elapsed: 00:00:00.00
SQL> show error
Errors for PROCEDURE ABC:
LINE/COL ERROR
3/5 PLS-00103: Encountered the symbol "NUMBER" when expecting one of
the following:
:= . ( @ % ;
The symbol ":=" was substituted for "NUMBER" to continue.
SQL> create or replace procedure abc as
2 val number;
3 begin
4 select abcd into val from dual;
5 dbms_output.put_line(val);
6 end;
7 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec abc;
100.22
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> -
Call unix commands from stored procedures
My stored procedure requires to call unix commands HOW DO I DO IT?
nulli do not know pl sql but in java you can use:
Runtime.getRuntime().exec("YOUR UNIX COMMAND");
real example:
Runtime.getRuntime().exec("ls");
but you must be careful with using that...
especially if you want to wait till the process finishes..
rgds, -
Calling Oracle Reports from stored procedures
Hi ,
Can anybody tell me whether this is possible and if so, how it can be done. Thanks for your help.
Regards,
DeepaOracle Forms allows you to easily integrate Oracle Reports into your
applications. However, on the Macintosh, it is not possible to use
the normal Oracle Reports runtime to generate ASCII text files. In
order to allow ASCII text files to be generated with Oracle Reports
on the Macintosh, the Reports<TEXT> Runtime applications was
developed. This version of the runtime only allows you to generate
text files and should not be used for other purposes.
While the Reports<TEXT> Runtime application has been provided, there
is no built in integration with Forms. This bulletin explains a
method which you can use integrate these two applications with little
effort. In order to use this method, you will need the following
items installed on your computer:
* Oracle Forms 4.0
* Oracle Reports 2.0
* Oracle Command 1.0
* AppleScript 1.1. This is available as part of the Macintosh
Operating System version 7.5 as well as with certain 3rd party
applications.
Because the only way to use the Reports<TEXT> Runtime application is
through Oracle Command, we will be using Oracle Command to run the
Reports<TEXT> Runtime application. However, we need some way to
communicate with Oracle Command which report we would like to run and
what parameters we would like to pass in to Reports. To accomplish
this goal, an AppleScript application will be used. Forms can use
AppleEvents (Apple's method for inter-application communication) to
communicate with this AppleScript application which can then create
an Oracle Command script file to run. So, the summary of events
which will take place are as follows:
1. Forms dynamically creates a command line to run the
Reports<TEXT> Runtime application.
2. Using AppleEvents, Forms communicates this command line to the
AppleScript application which writes out an Oracle Command
script file.
3. The AppleScript application communicates with Oracle Command and
tells it to run the script which it just created.
4. Oracle Command runs the script which invokes the Reports<TEXT>
Runtime application.
1. Creating the AppleScript Application
The core of this solution is the AppleScript Application. While it
is not necessary for you to be familiar with AppleScript, it will
help tremendously in your understanding of how everything works.
Here we provide you with an AppleScript which provides the
functionality we need to implement our procedure.
Note: This AppleScript is designed to work with the Macintosh
Operating System version 7.5. It should work with earlier
versions of the Operating System, but no guarantees are
made. Furthermore, there are known problems with the version
of AppleScript provided with version 7.1.2 of the Operating
System which will cause your machine to crash when this
script is executed. These problems with AppleScript were
corrected for the version 7.5 release of the Operating System.
-- This AppleScript Application is responsible for being a
-- "go-between" between Oracle Forms and Oracle Command. It is
-- responsible for both dynamically creating Oracle Command script
-- files and disposing of these files.
-- NOTE: This AppleScript Application was written for the Macintosh
-- Operating System version 7.5. It has not been tested
-- on any other version of the Macintosh Operating
-- System.
-- Author
-- ======
-- Doug Bitting
-- Oracle Worldwide Technical Support
-- Apple Desktop Products Group
-- Date: 21-MAR-95
-- The syntax "on <<...>> args" is how you setup an AppleScript to
-- accept AppleEvents.
-- Be careful, the << and >> characters are option-\ and option-|
-- respectively. They are not two less-than signs and two
-- greater-than signs.
on <<event R20Trunt>> cmdScript
-- First, let's construct a, hopefully, unique file name
set dt to ((current date) as string)
set hr to (word 5 of dt)
set mn to (word 6 of dt)
set sec to (word 7 of dt)
set fName to (hr * 3600 + mn * 60 + sec as string)
-- For this example, we will put all dynamically constructed
-- script files onto the desktop.
set tFold to (path to desktop)
set fName to (tFold & "tmp." & fName as string)
-- set up a mnemonic for the Return character
set cr to (ASCII character 13)
try
-- open our Oracle Command script file
-- The sequence <opt-l> at the end of the following line
-- should be type in as an option-l (that is, a lowercase L).
set fRef to (open for access file fName with write <opt-l>
permission)
-- Now, write the Oracle Command command line which was
-- passed to us via AppleEvents.
-- The sequence <opt-l> at the end of the following line
-- should be type in as an option-l (that is, a lowercase L).
write (cmdScript & cr) starting at <opt-l>
((get eof fRef) + 1) to fRef
-- Now we have to also ask Oracle Command to let us know
-- when it is finished with the script file we are
-- creating. Basically, we are asking Oracle Command to
-- use AppleEvents to let us know when to throw away the
-- file we are creating
-- The sequence <opt-l> at the end of the following lines
-- should be type in as an option-l (that is, a lowercase L).
write ("host SENDAE aplt R20T remv ---- t \"" & fName <opt-l>
& "\";" as string) starting at <opt-l>
((get eof fRef) + 1) to fRef
-- close the Oracle Command script file
close access fRef
-- Now that we have setup the temporary file,
-- tell Oracle Command to execute it.
tell application "Oracle Command 1.0"
runscript fName
end tell
-- You can put some error handling here if you'd like.
end try
end <<event R20Trunt>>
-- This is the AppleEvent handler to clean up when we are done. It
-- simply throws the temp file into the trash can.
-- Be careful, the << and >> characters are option-\ and option-|
-- respectively. They are not two less-than signs and two
-- greater-than signs.
on <<event R20Tremv>> fName
tell application "Finder"
move (fName as alias) to (path to trash)
end tell
end <<event R20Tremv>>
2. Setting Up Forms
It is useful to setup a PL/SQL Program Unit to hide the details
behind running the Text Runtime. Here is a suggested PL/SQL Program
Unit for you to use:
-- The following procedure is used to hide some of the details in
-- using the AppleScript Application. It accepts 4 arguments:
-- * The report name
-- * The name of the output file
-- * The parameters you would like to pass in. These need to be
-- formatted just as if you were calling reports from a
-- command line.
-- * A connect string for Reports<TEXT> Runtime to connect with.
procedure run_text_report (
rName in char,
oName in char,
params in char,
cString in char) is
cLine varchar2(1000);
begin
cLine := 'execute r20text module='| |rname;
cLine := cLine | | ' userid='| |cString;
cLine := cLine | | ' paramform=no batch=yes';
cLine := cLine | | ' destype=file desname='| |oname;
cLine := cLine | | ' desformat=dflt.prt '| |params| |';';
host('SENDAE aplt R20T runt ---- t "'| |cLine| |'"');
-- NOTE: in the above host() command, the series of quotes at the
-- end reads as follows: double-quote, single-quote, vertical
-- bar, vertical bar, the word cLine, vertical bar, vertical
-- bar, single-quote, double-quote, single-quote.
end;
Here is an example of how I can use the above procedure. In a
WHEN-BUTTON-PRESSED trigger, I might have:
declare
reportName varchar2(16);
outputName varchar2(64);
paramVals varchar2(64);
connectStr varchar2(16);
begin
-- We want to run the report named "myreport". The output from this
-- report should go into a file named "output.txt" located in the
-- "Reports" directory on my hard drive. This report accepts two
-- parameters: p_start_date and p_end_date. The connect string for
-- the database I am using is simply "scott/tiger"
-- Setup some variables to hold all the information I want to pass
-- in to run_text_report(). This information is put into variables
-- for readability.
reportName := 'myreport';
outputName := 'HD:Reports:output.txt';
paramVals := 'p_start_date=''01-MAR-95'' p_end_date=''31-MAR-95''';
connectStr := 'scott/tiger';
-- Run the report
run_text_report(reportName, outputName, paramVals, connectStr);
end;
3. Putting the pieces together
In order for this solution to function, you need to make sure that
both your AppleScript application and Oracle Command are running when
you make a call to run_text_report(). It is possible for you to
launch Oracle Command from within Oracle Forms with the following
line of code:
host('LAUNCHID oBTL');
If you place the above line of code in a WHEN-NEW-FORM trigger, you
can assure that Oracle Command will be running when your form is
launched.
It is also possible for you to have Oracle Forms launch your
AppleScript application. However, in order for you to do this, you
need to be very familiar with the Macintosh Operating System, how to
change the creator type of a file, and know what effects that change
can produce. If you do not know how to change the creator type of
your AppleScript application or are not comfortable doing so, you
should simply document that your users need to make sure to launch
your AppleScript application before trying to use your Form.
However, if you know how to change the creator type of your
AppleScript application and are comfortable doing so, here are the
steps you will need to take to have Oracle Forms launch your
AppleScript application for you:
* Change the creator type of your AppleScript application to
something unique.
* Modify the run_text_report() procedure. You need to change the
four character sequence "aplt" found in the host() command to the
new creator type of your AppleScript application.
* Add the line host('LAUNCHID <your new creator type>'); to your
WHEN-NEW-FORM trigger or to whichever trigger you placed the
host('LAUNCHID oBTL'); statement.
There is one significant difference between RUN_PRODUCT and this
solution. With RUN_PRODUCT, you have the option of specifying
whether or not the call should be synchronous or asynchronous.
However, the call to run_text_report() will always be asynchronous.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Deepa Pai:
Hi ,
Can anybody tell me whether this is possible and if so, how it can be done. Thanks for your help.
Regards,
Deepa <HR></BLOCKQUOTE>
null -
How to call sqlldr utility in stored procedure
Hi,
i want to call sqlldr exe from stored procedure.
Regards,
Tushar Josihuser12044491 wrote:
currently i am working on oracle release 10g R2.
i am not very much sure whether all CTL option are available in the external table.Before you decide on the method you should clearly understand the following. SQL*Loader is client side tool while job and external table are server side tools. Therefore, unless you are connecting to oracle from database server or file you are loading is accessible from database server, neither job nor external table will help you. And now back to your question - yes, not all SQL*Loader features are available for external tables but most of the time there is a way around it.
SY. -
Remote execution of DTS packages from Java Stored Procedures
I'm an Oracle 10G DBA and Linux/Unix Sysadmin looking for a Java guru to help me find a reusable template or locate a solid programming methodology (examples) that will enable me to connect via JDSI to SQL Server 2000/2005 and remotely execute DTS packages from within Oracle. I am working at office that's absolutely addicted to MicroSlop products and the DBA team cannot conceive of giving up their precious DTS packages. I've already converted their MS SQL Server 2000 database to Oracle 10G on RHEL4 via SQLDeveloper but I am unschooled in the art of java programming and would like to locate some sort of rudimentary template or examples or java class that can easily be loaded into the Oracle 10G database instance via the loadjava utility. These java classes/methods/stored procedures need to be executable from within embedded PL/SQL code and able to connect to SQL Server 2000 to execute DTS packages via passing dtsrun commands ... Any help or direction would be greatly appreciated.
Hi Ilford:
Sure you can use fully package notation in your Java classes.
Look at this Java source code:
http://dbprism.cvs.sourceforge.net/dbprism/cms-2.1/src/com/prism/cms/core/
All of them are Java Stored procedures.
Best regards, Marcelo. -
How to call PL-SQL script/stored procedure from Java?
Assume I want to call a PL-SQL stored procedure from external Java program.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThis forum is for Oracle only not for java
Ug -
How to call PL-SQL script/stored procedure from BPEL?
Assume I want to call a PL-SQL stored procedure from BPEL.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThe database adapter supports calling stored procedures. There is an example called "File2StoredProcedure" that you can use as a reference to get started.
Maybe you are looking for
-
Routing Issue Accessing Inside Interface of ASA
Ok so I'm making this more complex than it needs to be and can't see the forest for the trees. I'm setting up an ASA 5510 with multiple contexts. I'm working with my main internal context for my internal traffic. I have created interfaces on this con
-
Why does my dock look different than normal ML docks
Hi, I upgrade to ML and over time my dock started to look diffrent, it has two indicator lights instead of a line, can you help me, thanks.
-
Loading Landscape PDF in flash Paper
I am using Flash Paper to load different pdf's in flash but i am facing one problem that once i convert any pdf that is on landscape size it will rotate the pdf in swf and it looks like a4 size so any idea how to fix it
-
WebDynpro Method from a Class Interface?
Is possible to call a webdynpro method from a class interface that is register in the WDDOINIT of the same WEBDYNPRO component? I register my custom webdynpro screen into FPM_OIF_COMPONENT, now when I execute a FPM action my WebDynpro receives the ac
-
Help me: I have locked user cn=orcladmin in oid
Hello. Pleas help me, I have locked user cn=orcladmin in oid production environment I have tried to unlock with this procedure, but It doesn´t work: [oracle@appamucm01pro admin]$ /opt/oracle/mw/mw_idm/Oracle_IDM/ldap/bin/oidpasswd connect=OIDDB unloc