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
END
Thanks for sharing.
Similar Messages
-
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 -
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. -
Calling SSIS package from DTEXEC in SQL Server 2012
Hello,
I have a package called test.dtsx developed in SSIS vs 2010 (project deployment model). It has two project parameters one is db connection (string) and one is classnumber(string). This package has been deployed as file system and in SSISDB. I want to
assign the following values to the project parameters
$Project::DBConnection - Data Source=localhost;User ID=User;Password=password;Initial Catalog=testdb;Provider=SQLNCLI11.1;Persist Security Info=True;Auto Translate=False;
$Project::Classnumber - 10
What is the syntax to call this package from dtexec passing values for parameters
1. as a file system deployment
2. as a package in SSIS db(catalog)
thankshttp://msdn.microsoft.com/en-ca/library/hh231187.aspx has an example
Dtexec /isserver “SSISDB\MyFolder\MyProject\test.dtsx” /server “.” /parameter $Project::DBConnection;thevalue /parameter anotherparam(int32);12
Arthur My Blog -
Is it possible to call a package from DB in ADF?
Hi,
I am using Jdev 10.1.3.3 with ADF. I want to call a package from
my DB from jdev. Is it possible with ADF? Please let me know.
Thanks,
VenkiHi,
This is my code to call the package.
String amDef = "model.service.DAFService";
String config = "DAFServiceLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
CallableStatement cstmt = null;
String stmt = "begin call CP_DAF_PKG.DAF_PROCESS(?,?,?,?,?,?,?,?,?); end; ";
cstmt = getDBTransaction().createCallableStatement(stmt,0);
But in this case, I am getting
oracle.jbo.InvalidOwnerException: JBO-25301: Application module is not a root app module but has no parent
I understand the reason for this error. I need to call the
createcallableStatement from the application module that I have above.
Something like am. (call the package)
But not sure about any method which does that..
Please let me know if you know the way to solve it.
Thanks,
Venki -
How to call a package from within a package
How would I call a package from within a package and pass variables to it. For instance I am trying to pass variables to a log package from another package when a user inserts or updates a table
First, technical questions need to be addressed to one of the technical forums. Products | Database | SQL & PL/SQL would be appropriate for this question. Please direct any followup to that forum.
Second, you cannot call a package; a package is a collection of stored procedures and functions. You can call a packaged function or procedure from another package simply by specifying the package name and the procedure
CREATE OR REPLACE PACKAGE pkgA
AS
PROCEDURE callPkgB;
END;
CREATE OR REPLACE PACKAGE BODY pkgA
AS
CREATE PROCEDURE callPkgB
AS
BEGIN
pkgB.someProcedure( 'Some argument' );
END callPkgB;
END pkgA;In general, any packaged procedure can be called by specifying the schema, package, and procedure name, i.e.
EXEC mySchema.myPackage.myProcedurethough the schema and package can be omitted if the calling procedure is in the same schema or package.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to call a package from a different instance?
Dear all:
how to call a package from a different instance?
for example:
package A belongs to instance A1
package B belongs to instance B1
Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
Regards
TerryTerry Chen wrote:
Dear all:
how to call a package from a different instance?
for example:
package A belongs to instance A1
package B belongs to instance B1
Now I want to call the package B in instance A1, how can I do ? my environment is oracle 10g
First you have to create create dblink in A1 database as below
CREATE DATABASE LINK INSA1
CONNECT TO USER_NAME IDENTIFIED BY <pass>
USING 'B!' Then you can execute exec pack_b@INSA1; -
How to call a package from the Report in Oracle Application Express
How to call a package from the Report in Oracle Application Express
Hello,
What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
Or do you want to execute a procedure when something happens on the page, like clicking a button?
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this reply by marking it as either Helpful or Correct ;-) -
While calling plsql package from Pro*c getting ORA-1426 error
Hi Friends
I am calling a package from Pro*c and getting numberic overflow error ORA-1426 but when i introduce a debug message such as printf or calling standard oracle utility to write in a log file no error comes. So how just introduction of debug messages is resolving the error.Can any one throw some light on it, whether it is some kind of synchronization issue or something else
Regards
AbhijeetPretty hard to guess here since you're not providing any sample code.
However:
"Internally, PL/SQL assigns the values of the bounds to temporary PLS_INTEGER variables, and, if necessary, rounds the values to the nearest integer. The magnitude range of a PLS_INTEGER is -2147483648 to 2147483647, represented in 32 bits. If a bound evaluates to a number outside that range, you get a numeric overflow error when PL/SQL attempts the assignment. "
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/loop_statement.htm#sthref2852 -
Calling SSIS package from C# Windows Service Fails
Hi All.
I've got an SSIS package that reads from an Excel file and populates a database. The Excel file location gets passed in to the package as a variable. Also the Protection Level of the package is set to EncryptSensitiveWithPassword.
This all works fine when I run the package from Visual Studio or using DTEXEC. When I try to run it from a C# Windows Service though I get the following exception:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft Office Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively
by another user, or you need permission to view and write its data.".
SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Input Excel Connection" failed with error code 0xC0202009. There may be error messages posted before this
with more information on why the AcquireConnection method call failed.
Dedupe Worksheet failed validation and returned error code 0xC020801C.
One or more component failed validation.
There were errors during task validation.
The windows service runs with LocalSystem account and the following code is used to call the SSIS Package:
Application app = new Application();
Package package = null;
app.PackagePassword = "*******";
//Load the SSIS Package which will be executed
package = app.LoadPackage(@"C:\Projects\DataDedupeMatch\DataDedupeMatch\DataDedupe.dtsx", null);
//Pass the varibles into SSIS Package
package.Variables["User::FilePath"].Value = e.FullPath.Replace(@"\\", @"\");
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
I would really appreciate if someone could help me out with this.
Thanks in advance,
DeonInstead of hosting the SSIS runtime in your service, you should use a separate host process for your SSIS package. You're using the Office drivers, which aren't designed or supported for running in long-lived unattended processes like a Windows Service.
You can use your own SSIS hosting code, or just use dtexec.exe to host your package. In either case you would start the child process with
Process.Start.
David
David http://blogs.msdn.com/b/dbrowne/ -
Calling a package from shellscript
Hello,
I am trying to run open interface for GL. I am a newbie to oracle apps.
The flow and steps i am following are
1. Load some sample data into staging table using sqlldr.
2.Validate and insert the data into gl_interface using pl/sql package.
3. Write a shell script to call the sqlldr and pl/sql package.
4.Register the script as concurrent program in apps.
When i run this request ,the log file shows no errors. But the data is not loaded in gl_interface table.
I tried with a simple pl/sql procedure (not a package) it ran fine. The data was loaded.
ex:
sqlplus user/pwd<<EOF
exec sql_proc();
EOF
But now i have two different procedures, so created
a package. How do i call that package in the shell script. I also have IN parameters for the second procedure.
Should i mention them here (in the shell script).
i tried
sqlplus user/pwd<<EOF
exec package.sql_proc();
exec package.sql_proc2();
EOF
Any help would be really appreciated.
Thank you,
SrikanthYou can define the variables in your shell script to pass to the package/procedure for e.g. if you wanted to execute fnd_client_info.setup_client_info, your shell script would look something like this
p_usr_id=$1
p_app_id=$2
p_resp_id=$3
( sqlplus -s /nolog << end_of_sql
connect $p_sqlpwd
set head off
set feed off
set verify off
exec fnd_client_info.setup_client_info($p_app_id, $p_resp_id, $p_usr_id, 0);
exit
end_of_sql
) -
Hello,
I am trying to execute a SSIS package from SQL Server 2008 R2 stored procedure but getting error code 1 (as per my knowledge, error code description is as below:
0 The package executed successfully.
1 The package failed.
3 The package was canceled by the user.
4 The utility was unable to locate the requested package. The package could not be found.
5 The utility was unable to load the requested package. The package could not be loaded.
6 The utility encountered an internal error of syntactic or semantic errors in the command line.
Details:
I have a stored procedure named "Execute_SSIS_Package" (see below sp) which executes 'Import_EMS_Response' SSIS package (when I execute this package directly from SQL Server BID it works fine it means package itself is correct) and calling
it from SQL as:- EXEC Execute_SSIS_Package 'Import_EMS_Response'.
Here I receives error code 1.
Can anyone help me to resolve this issue please?
Thanks in advance!
CREATE PROCEDURE [dbo].[Execute_SSIS_Package]
@strPackage nvarchar(100)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @cmd VARCHAR(8000)
DECLARE @Result int
DECLARE @Environment VARCHAR(100)
SELECT @Environment = Waarde
FROM Sys_Settings
WHERE Optie = 'Omgeving'
--print @Environment
SET @strPackage = '"\W2250_NGSQLSERVER\BVT\' + @Environment + '\' + @strPackage + '"'
SET @cmd = 'dtexec /SQL ' + @strPackage + ' /SERVER "w2250\NGSQLSERVER" /Decrypt "BVT_SSIS" /CHECKPOINTING OFF /REPORTING E'
--print @cmd
EXECUTE @Result = master..xp_cmdshell @cmd, NO_OUTPUT
--print @Result
ENDIt has something to do with the security.
E.g. cmdshell is not enabled or the caller has not rights over the package.
There could be a syntax error, too.
I suggest you make the package runnable off a SQL Agent job then trigger the job from the stored proc with
sp_start_job <job name>
Arthur
MyBlog
Twitter -
Charges for calling Skype number from cell phone
Just purchased a skype phone number. Chose a local area code so family can call me while Iam in Italy. Will there be an additional charge on their cell phone when they call me. They have unlimited calls and text on there monthly cell plan. Will I have to pay skype if I answer call to my skype number on my cell phone? If I purchase a premium subscription will I be able to call home from Italy on my cell phone? And how much will that cost per minute- or will the monthly premium price give me unlimited calling and text from my cell?
thanks for your help! fondiSame problem here. I just bought the number though so wondering if it is a teething proble;
-
Calling SQL packages from java
How do I call ORACLE sql packages from java?
We are still using Oracle 7.3. Any sample code
would be appreciated.utility.processPLSQL( connRisk,
" Begin "
+ " hvar_sum.p_load_var_summary_data("
+ " '" + dfCall.format( priceDate ) + "', "
+ " '" + promptMonth + "',"
+ daysBack + ","
+ aliasType + ","
+ "'" + connRisk.owner + "'"
+ "); "
+ " end ; ",
"Load VaR Summary Data",
utility.noLogMsg ) ;
public boolean processPLSQL(
MyConnection conn,
String sql,
String dataType,
boolean createLogMessage ) {
double startTime = conn.log.getStartTime() ;
try {
CallableStatement cs = conn.theConnection.prepareCall(sql);
cs.execute() ;
cs.close() ;
conn.theConnection.commit();
if ( createLogMessage ) conn.log.logTiming( dataType, startTime ) ;
} catch ( SQLException e ) {
conn.log.logError( "Utility.processPLSQL; SQLException Error: " + e ) ;
System.out.println(new java.util.Date().toString() + "; User: " + conn.user
+ "; SQL: " + sql );
return false ;
return true ;
} -
BAPI for calling Z transaction From NON-SAP system
hi all, am new to BAPI i want to know that can we call any standard or Z transaction from NON-SAP system using BAPI if yes then plz let me know how.???
thanx...BAPI's are not used for calling transactions. They have the same result though, a business partner for example kan be created, and maintained via the GUI, but it can also be done via a BAPI. These BAPI's are created for calling them from (non-) SAP systems since they are remote enabled. However, this means that the calling application / party will have to 'build' some sort of application themselves in order to call these BAPI's from 'outside' of the SAP system.
The calling application will have to have access to the system, which can be maintained in the remote destination transaction SM59.
But enough of this, there are lots and lots of posts on SDN about BAPI's, remote destination etc.
Maybe you are looking for
-
I'm not receiving any emails since updating the latest softwear to my iphone 4. HELP please
-
How to configure idoc&workflow in PI 7.4?
Hello colleagues, I need configure the Idocs adn workflow in PI 7.4 but only I find documentation of PI 7.3. Can you help me? Thanks.
-
It happens that I can't create POP accounts, while I do easily with Entourage. The same data in Entourage work while in Mail don't. I can't understand why. Can anyone tell me what's wrong? Thanks
-
How to Configure VPN in RV016 using Qucik VPN for Windows 7 and Windows 8?
Hi guys, we have Cisco RV016 VPN Router configured with local subnet of 10.10.10.0/24 and one Static IP 117.218.xxx.xxx.for Local Gateway which is connected in WAN1 interface of RV016 Router. I have created the VPN tunnel in client to
-
Can we restrict the transaction code NEX from users
Hi all, we have a requirement to restrict the NEX tcode from the users. means that users are asking to not access the NEX tcode. Is it possible to do that ?