CF application to run SQL 2k JOB?

Hello All,
I would like to build an application to run a MS SQL Job.
The Job is located in \\ server \ Management \ SQL Server Agent \ Jobs .
II need to connect from an users desktop, have them click a button and run the SQL JOB.
Has any one done this?  Any information would help.
Thank you
TJones

Assuming that your datasource's default database is not 'msdb' you will need to use the qualified name of the stored procedure: database_name.schema_name.object_name.  Since 'dbo' is the default schema it can be left blank.
See T-SQL and ColdFusion examples below.  Be aware that I have not tested either of these.
T-SQL:
EXEC msdb.dbo.sp_start_job @job_name = 'LTC'
OR
EXEC msdb..sp_start_job @job_name = 'LTC'
In ColdFusion (You will need to add values or specify null="yes" for each cfprocparam )
<cfstoredproc procedure="msdb.dbo.sp_start_job" datasource="#mydsn#" returncode="yes" result="storedProc">
    <cfprocparam value="" cfsqltype="cf_sql_varchar" type="in" maxlength="128" />  <!--- @job_name  nvarchar(128) IN --->
    <cfprocparam value="" cfsqltype="cf_sql_char" type="in" />  <!--- @job_id  uniqueidentifier IN --->
    <cfprocparam value="" cfsqltype="cf_sql_integer" type="in" />  <!--- @error_flag  int IN --->
    <cfprocparam value="" cfsqltype="cf_sql_varchar" type="in" maxlength="128" />  <!--- @server_name  nvarchar(128) IN --->
    <cfprocparam value="" cfsqltype="cf_sql_varchar" type="in" maxlength="128" />  <!--- @step_name  nvarchar(128) IN --->
    <cfprocparam value="" cfsqltype="cf_sql_integer" type="in" />  <!--- @output_flag  int IN --->
</cfstoredproc>
You should review the SQL documentation and your datasource settings to verify that the user account associated with your datasource login has sufficient rights to start a job and to invoke procedures in the msdb database.
Info on object names in SQL Server:
http://msdn.microsoft.com/en-us/library/ms187879%28SQL.90%29.aspx

Similar Messages

  • Is there a way to get long running SQL Agent jobs information using powershell?

    Hi All,
    Is there a way to get long running SQL Agent jobs information using powershell for multiple SQL servers in the environment?
    Thanks in Advance.
    --Hunt

    I'm running SQL's to fetch the required details and store it in centralized table. 
    foreach ($svr in get-content "f:\PowerSQL\Input\LongRunningJobsPowerSQLServers.txt"){
    $dt = new-object "System.Data.DataTable"
    $cn = new-object System.Data.SqlClient.SqlConnection "server=$svr;database=master;Integrated Security=sspi"
    $cn.Open()
    $sql = $cn.CreateCommand()
    $sql.CommandText = "SELECT
    @@SERVERNAME servername,
    j.job_id AS 'JobId',
    name AS 'JobName',
    max(start_execution_date) AS 'StartTime',
    max(stop_execution_date)AS 'StopTime',
    max(avgruntimeonsucceed),
    max(DATEDIFF(s,start_execution_date,GETDATE())) AS 'CurrentRunTime',
    max(CASE WHEN stop_execution_date IS NULL THEN
    DATEDIFF(ss,start_execution_date,stop_execution_date) ELSE 0 END) 'ActualRunTime',
    max(CASE
    WHEN stop_execution_date IS NULL THEN 'JobRunning'
    WHEN DATEDIFF(ss,start_execution_date,stop_execution_date)
    > (AvgRunTimeOnSucceed + AvgRunTimeOnSucceed * .05) THEN 'LongRunning-History'
    ELSE 'NormalRunning-History'
    END) 'JobRun',
    max(CASE
    WHEN stop_execution_date IS NULL THEN
    CASE WHEN DATEDIFF(ss,start_execution_date,GETDATE())
    > (AvgRunTimeOnSucceed + AvgRunTimeOnSucceed * .05) THEN 'LongRunning-NOW'
    ELSE 'NormalRunning-NOW'
    END
    ELSE 'JobAlreadyDone'
    END)AS 'JobRunning'
    FROM msdb.dbo.sysjobactivity ja
    INNER JOIN msdb.dbo.sysjobs j ON ja.job_id = j.job_id
    INNER JOIN (
    SELECT job_id,
    AVG
    ((run_duration/10000 * 3600) + ((run_duration%10000)/100*60) + (run_duration%10000)%100)
    +
    STDEV
    ((run_duration/10000 * 3600) + ((run_duration%10000)/100*60) + (run_duration%10000)%100) AS 'AvgRuntimeOnSucceed'
    FROM msdb.dbo.sysjobhistory
    WHERE step_id = 0 AND run_status = 1
    GROUP BY job_id) art
    ON j.job_id = art.job_id
    WHERE
    (stop_execution_date IS NULL and start_execution_date is NOT NULL) OR
    (DATEDIFF(ss,start_execution_date,stop_execution_date) > 60 and DATEDIFF(MINUTE,start_execution_date,GETDATE())>60
    AND
    CAST(LEFT(start_execution_date,11) AS DATETIME) = CAST(LEFT(GETDATE(),11) AS DATETIME) )
    --ORDER BY start_execution_date DESC
    group by j.job_id,name
    $rdr = $sql.ExecuteReader()
    $dt.Load($rdr)
    $cn.Close()
    $dt|out-Datatable
    Write-DataTable -ServerInstance 'test124' -Database "PowerSQL" -TableName "TLOG_JobLongRunning" -Data $dt}
    You can refer the below link to refer out-datatable and write-dataTable function.
    http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/01/use-powershell-to-collect-server-data-and-write-to-sql.aspx
    Once we've the table details, I'm sending one consolidated email to automatically.
    --Prashanth

  • Errors running SQL Agent Jobs for 64 bit SSIS packages on a 64 bit server, but Source server 32 bit

    Hi,
    I can able ran the SSIS package in BIDS, since set to false in Run64BitRuntime property.
    Then I created SQL server Agent job I tried the following ways
    Step 1:
    Type is set as SQL Server Integration Services Packages,
    Run as - SQL Server Agent Service Account
    Package source - FileSystem
    then Execution option tab I selected 32 bit runtime
    and then run the job I am getting the below error
    Message
    Executed as user: CIT\svc_CS_SS2008Agent. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 32-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  7:29:17 AM  Error: 2013-11-28
    07:29:18.57     Code: 0xC0014020     Source: Example Connection manager "DataSource.DataExtract"     Description: An ODBC error -1 has occurred.  End Error  Error: 2013-11-28 07:29:18.57    
    Code: 0xC0014009     Source: Imports20_OAC_Gifts Connection manager "DataSource.DataExtract"     Description: There was an error trying to establish an Open Database Connectivity (ODBC) connection with the
    database server.  End Error  Error: 2013-11-28 07:29:18.59     Code: 0x0000020F     Source: DFT_Example ODBC_SRC Example [11]     Description: The AcquireConnection method call to the connection
    manager DataSource.DataExtract failed with error code 0xC0014009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2013-11-28 07:29:18.59    
    Code: 0xC0047017     Source: DFT_Example SSIS.Pipeline     Description: ODBC_SRC Example failed validation and returned error code 0x80004005.  End Error  Error: 2013-11-2
    Step 2:
    Type - Operating sytem (CmdExec)
    Run as - Sql Server agent service account
    Command - C:\Program Files\Microsoft SQL Server\110\DTS\Binn\dtexec.exe /FILE "D:\Example\Example.dtsx" /x86  /CHECKPOINTING OFF /REPORTING E
    then run the job I am getting the below error
    Message
    Executed as user: MIS\svc_CS_SS2008Agent. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  6:37:58 AM  Error: 2013-11-28
    06:37:58.94     Code: 0xC0014020     Source: Example Connection manager "DataSource.DataExtract"     Description: An ODBC error -1 has occurred.  End Error  Error: 2013-11-28 06:37:58.96    
    Code: 0xC0014009     Source: Example Connection manager "DataSource.DataExtract"     Description: There was an error trying to establish an Open Database Connectivity (ODBC) connection with the database server. 
    End Error  Error: 2013-11-28 06:37:59.01     Code: 0x0000020F     Source: DFT_Example ODBC_SRC Example [11]     Description: The AcquireConnection method call to the connection manager DataSource.DataExtract
    failed with error code 0xC0014009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2013-11-28 06:37:59.07     Code: 0xC0047017    
    Source: DFT_Example SSIS.Pipeline     Description: ODBC_SRC Example failed validation and returned error code 0x80004005.  End Error  Error: 2013-11-28 06:37:59.12     Code: 0xC004700C    
    Source: DFT_Example SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2013-11-28 06:37:59.16     Code: 0xC0024107     Source: DFT_Example     
    Description: There were errors during task validation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).Started:  6:37:58 AM  Finished: 6:37:59 AM  Elapsed:  1.373 seconds.  Process Exit Code 1. 
    The step failed.
    Note:
    My source server is 32 bit and development environment in 64 bit
    if anybody have idea please share your knowledge

    Hi BIRam,
    Based on the current information, the issue may be caused by the factor that the SQL Server Agent Service Account doesn’t have access to the MySQL server. Try to create a SQL Server Agent Proxy account that has sufficient permission on the MySQL server.
    In addition, also pay attention to the package protection level setting.
    For more information, please see:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/e13c137c-1535-4475-8c2f-c7e6e7d125fc/how-do-i-troubleshoot-ssis-packages-failed-execution-in-a-sql-agent-job?forum=sqlintegrationservices.   
    Regards,
    Mike Yin
    TechNet Community Support

  • Running SQL agent jobs in parallel

    I have around 60 SQL agent jobs (each job has 1 step that loads data from ORACLE to SQL using attunity) that run SSIS packages that I need to run in parallel.  I did some testing and found that the server can handle 10 of them running at the same time.
     I know I need to loop through sysjobhistory and find the ones (all 60 jobs start with PS) that haven't ran today, currently not running and the first tow words of the name = 'PS'.  Any advice on how to get this accomplished would be appreciated.
    I have seen some articles that mention adding 10 data flows to a SSIS package and run them that way but I would like for SQL to handle it, so I can get the time.
    Thanks!

    That will definitely help identify the jobs but I need to figure the looping logic that will allow 10 jobs to run in parallel.
    try this.. not tested.. left comments where possible for you to understand..may need to tweak it a bit..
    declare @a intset @a=0
    declare @jobname nvarchar(200)
    -- checks if there are already 10 jobs running
    while (@a <10) and ((Select count(C.Name) as [JobName]
    from (Select max(Session_id) as Session_Id from msdb.dbo.syssessions) A
    INNER JOIN msdb.dbo.sysjobactivity B on A.Session_id=B.Session_ID
    INNER JOIN msdb.dbo.sysjobs C on B.job_id=C.Job_ID
    where B.stop_execution_date is null AND B.run_requested_date is not null and C.Name like 'PS%') < 10)
    begin
    --loops through to fetch one non-running job at a time and fetches upto 10 jobs
    Select top 1 @jobName = name
    from msdb.dbo.sysjobs X
    INNER JOIN msdb.dbo.sysjobactivity Z on Z.job_id=X.Job_ID
    where name like 'PS%' and
    --checks the job is currently not running
    name not in (
    Select C.Name as [JobName]
    from (Select max(Session_id) as Session_Id from msdb.dbo.syssessions) A
    INNER JOIN msdb.dbo.sysjobactivity B on A.Session_id=B.Session_ID
    INNER JOIN msdb.dbo.sysjobs C on B.job_id=C.Job_ID
    where B.stop_execution_date is null AND B.run_requested_date is not null)
    --makes sure the job already did not run today
    and cast(Z.run_requested_date as date)<>cast(getdate() as date)
    order by name
    Execute msdb.dbo.sp_start_job @job_Name=@jobName
    set @a=@a+1
    End
    Hope it Helps!!

  • Run SQL Agent Job in endless loop(When it's done, start over again)

    Hi All,
    There is an SQL Agent Job containing a complex Integration Services Package performing some ETL Jobs. It takes between 1 and 4 hours to run, depending on our data sources. The Job currently runs daily, without problems. What I would like to do now is to
    let it run in an endless loop, which means: When it's done, start over again.
    The scheduler doesn't seem to provide this option. I found that it would be possible to use the steps interface to go to step one after the last step is finished, but there's a problem using that method: If I need to stop the job, I would need to do that in
    a forceful way. However I would like to be able to let the job stop after the next iteration. How can I do that?
    Thanks in Advance...

    Seriously I cant think of a reason for continuosly running a step like this
    Do you mean you need to keep on polling db for something continuosly ?
    If thats the requirement there's no need of continuosly calling the step
    Instead of that you can include a loop with wait logic to keep on checking for your condition until it satisfies. You can WAITFOR clause for that
    see an example here where I've implemented similar logic in SSIS
    http://visakhm.blogspot.in/2011/12/simulating-file-watcher-task-in-ssis.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Problem adding data to the CRM /Saas application by running SQL commands

    Hello,
    I've been following the CRM/ Saas tutorial:
    http://www.oracle.com/technology/pub/articles/bobrowski-saas.html
    and I tried to run the SQL commands in the tutorial to populate the TENANTS, CUSTOMERS, TENANT_COLUMNS, and USERS tables and keep on getting an "ORA-00911: invalid character" error.
    I could use the Object Browser page to do this but would like to know how to do this by running a SQL command.
    Has anyone else encountered this problem when trying to populate the tables in the CRM application?
    Thanks
    Linda

    Hello,
    Are you sure you copied it correctly?
    If you try to run 1 create statement, does that work?
    For ex.
    -- USERS
    INSERT INTO users (username, tenant_id)
    VALUES ('MIKE',1);
    INSERT INTO users (username, tenant_id)
    VALUES ('JOE',2);
    COMMIT;
    Does that work? I don't see that many special characters...
    What you may try to do is to change the ; by a /
    for ex.:
    INSERT INTO users (username, tenant_id)
    VALUES ('MIKE',1)
    INSERT INTO users (username, tenant_id)
    VALUES ('JOE',2)
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

  • HELP..how to run sql batch jobs?? please give examples

    I have problems running scripts reference by unc path..anybody can help??
    UNDER PARAMETERS TAB:
    SQL Script @\\csdowcode001\dba$\SCRIPTS\PURGE_SCHEDULER_LOGS_X.sql (i put)
    Enter SQL or a fully qualified script name on the remote hosts, for example, "@script".
    Parameters /nolog ( i put)
    Enter optional parameters to SQL*Plus.

    by default the root directory for scripts is the $AGENT_ORACLE_HOME/sysman/emd directory. You can either put all of your scripts there, or create a directory there. Then when you call the script from OEM you can use the following
    @script.sql
    if you create a directory in the $AGENT_ORACLE_HOME/sysman/emd directory called scripts then you can put your scripts there and run the script like this
    @scripts/script.sql
    hope this helps,
    Landon

  • Script to stop running SQL Agent job without passing job name as a parameter

    Looking for script to stop running job and don’t want to pass job name as a parameter, any job which is in running state I want that to be stop/disable.
    I have script to disable all jobs however if any jobs are in running state my requirement is to stop that job immediately and gets disable.
    Rahul

    Try the below scripts and then apply script to disable all jobs.
    execute xp_cmdshell 'net stop sqlserveragent'
    execute xp_cmdshell 'net start sqlserveragent'
    Regards, RSingh

  • User created SQL Agent Job that uses linked server with Windows authentication

    OK, here's what I want to do, but not sure exactly what I need to accomplish it.
    Environment
    Windows 2008 Enterprise
    SQL 2012 Enterprise
    SQL Server & SQL Agent running under AD account (which has local Windows Administrative privileges...yes, I know..bad!)
    Linked server to Teradata utilizing AD account mappings (the linked server works successfully and each windows login is mapped to a Teradata LDAP login)
    Requirement
    Allow non sysadmins to create SQL Agent jobs which execute TSQL statements which use OPENQUERY(LDAPLinkedServer, '....) syntax
    I've already given the non sysadmins the necessary permissions to create and run SQL Agent jobs, and I understand that the jobs run under their login context, but I suspect that I'm missing something when it comes to the linked server.
    Each windows user could have access to different databases/tables on the Teradata system that even I (the SQL Server sysadmin) don't have access to.
    How can I facilitate this functionality?  Any ideas?

    I think I may have been over complicating the Teradata piece.  The authentication methodology in Teradata is LDAP, which just means that it authenticates against AD, but you still have to submit your Windows login & password.  It doesn't automatically
    authenticate you just because you're logged into Windows.  
    The linked server has the mapping for the individual windows logins like:
    Local Login = <domain>.<windows id>
    Remote User = <windows id>
    Remote Password = <windows password>
    This setup requires the user to have to change the passwords in the linked server whenever they change their passwords according to domain policy (every xx days)...but we've created a utility proc that they can use to do this.
    So, I'm thinking that Teradata isn't really part of this equation.

  • SSIS Package will only run as SQL Agent Job when I have remote desktop to server open.

    Hey guys, so I have another problem to add to the already massive 'SSIS/SQL Server Agent Job' pile. After days of searching, I can't seem to find anything specific to my problem though.
    The setup is as follows: a SSIS package that refreshes and saves excel files that are hosted on a server. The package runs fine on the local machine, using BIDS on the server, and will even work as a SQL Agent Job on the server IF there is a remote
    desktop connection to the server. To elaborate, if I simply run the job as you would normally do it will fail and give the below error. If I run the job while either myself, or a different machine, has a remote desktop connection to the server where the
    job is scheduled - it will run successfully.
    Below is the error from the History File of the job. Any help would be greatly appreciated.
      Source: Refresh Excel and Save      Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8000401A): Retrieving
    the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a.     at ST_79772452677f4de1852d5ffbba3e5232.csproj.ScriptMain.ExcelRefresh(String FileName)    
    at ST_79772452677f4de1852d5ffbba3e5232.csproj.ScriptMain.Main()     --- End of inner exception stack trace ---     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&
    sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)    
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
    invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo
    culture, String[] namedParams)     at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)     at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
    UPDATE:
    In my previous post the Identity in DCOM Config file for Microsoft Excel was set as The Interactive User. The job was working only when I had a remote connection to the server open.
    If I set the Identity to 'This User' and use the username and password of the server login account, it will work as a scheduled job without needing an open remote connection to the server. So it works, great! but I have reservations setting this
    for all instances of Excel for the server. I'm sure other users have different accounts they use for running Excel. Any suggestions around this?

    Hi LiamSexton,
    It should be the server-side Automation of Office issue described in the following KB article:
    http://support.microsoft.com/kb/257757 
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit
    unstable behavior and/or deadlock when Office is run in this environment.
    User Identity: Office applications assume a user identity when the applications are run, even when Automation starts the applications. The applications try to initialize toolbars, menus, options, printers, and some add-ins based on settings in the user
    registry hive for the user who launches the application. Many services run under accounts that have no user profiles (such as the SYSTEM account or the IWAM_[servername] accounts). Therefore, Office may not initialize correctly on startup. In this situation,
    Office returns an error on the CreateObject function or the CoCreateInstance function. Even if the Office application can be started, other functions may not work correctly if no user profile exists.
    To work around the issue, you can refer to the following alternative introduced in the article:
    Most server-side Automation tasks involve document creation or editing. Office 2007 supports new Open XML file formats that let developers create, edit, read, and transform file content on the server side. These file formats use the System.IO.Package.IO
    namespace in the Microsoft .NET 3.x Framework to edit Office files without using the Office client applications themselves. This is the recommended and supported method for handling changes to Office files from a service.
    Regards,
    Mike Yin
    TechNet Community Support

  • Application team runs a job which never completes.

    Hi,
    Application team runs a job which never completes in pkterp database (which is beta database). This program runs 24 hours but it never completes. The same job runs fine in INT, QA, PRE-PROD,prod database and completes in 90 minutes. Please let me know what are the parameters to check. I compared some parameters open_cursors, parallel_ they are same with pre-prod. The process has subprocesses which are parallel processes and i saw the wait events in TOAD they are
    PX Deq: Execution Msg, PX Deq Credit: send blkd. These 2 wait events are there repeated multiple times for the subprocesses. These wait events are there for most of the time in waiting status. Please let me know what else to check & implement to solve the issue.
    Thanks
    Edited by: user01 on Apr 20, 2012 10:21 PM

    Please let me know what are the parameters to check. RUN_JOB_SPEED=(FAST,GLOBAL,FOREVER)
    :) joke
    I compared some parameters open_cursors, parallel_ they are same with pre-prod. Please let me know what else to check.1. Check if stats in pkterp are fresh. Or re-gather.
    2. You better start statspack couple of times when job runs (or AWR if you have a license on it) and get reports from where you can figure out SQLs that are slow, and other things that may slow them down. Then tune those SQLs or environment to meke them run fast.
    4. You also may set trace on the job session, then tkprof it.
    3. You or developer may execute job's code in manual mode, peace by peace and look what slows down. Then tune slow parts.

  • How to Run SSIS Package through SQL AGENT Job

    I am good with SSIS, I created a package which will load the excel files to SQL SERVER  tables. To Implement this I wrote the C# code to extract the first sheet name only, and then
    package will load the data present the first sheet only. The package working fine when i run this through BIDS. But the same package throwing error at C# code step when i am running this package through SQL AGENT JOB. When i searched for this, i have seen
    many posts saying that, this is happening becoz of using Microsoft.interop.excel references inside the c# code. Please help me with this. Is there any alternate way in c# to extract the first sheet name(not based on ascending order) of an excel file with out
    using interop. Or
    How to configure SQL AGENT job to run suceessfully when using interop inside the code.
    My UAT server is of 64 bit. And i have to run this in the same server.
    I tried creating  "Desktop" folder in "C:\Windows\System32\config\systemprofile\"
    Error:Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.     at ST_ecfa668f250a45e18c95639c9ffd64d4.csproj.ScriptMain.Main()
        --- End of inner exception stack trace ---     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)    
    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
    Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     at
    System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)     at System.Type.InvokeMember(String name, BindingFlags
    invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)     at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()  End Error  Error: 2015-02-27 11:24:00.23     Code: 0x00000001
        Source: User Mail      Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error
    occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could
    not open a connection to SQL Server)     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
        at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
        at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)     at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
    host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)     at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString
    connectionOptions, String newPassword, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword,
    SqlConnection owningObject, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)  
      at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)     at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owning...
     The package execution fa...  The step failed
    using System;
    using System.Data;
    using System.Diagnostics;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using System.Data.OleDb;
    using Microsoft.Office.Interop;
    using System.Runtime.InteropServices;
    namespace ST_ecfa668f250a45e18c95639c9ffd64d4.csproj
    [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region VSTA generated code
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    public void Main()
    { /*Passing the file path via User::File_Name Variable*/
    string FileName = Dts.Variables["User::File_Name"].Value.ToString();
    Microsoft.Office.Interop.Excel.Application xlApp = null;
    Microsoft.Office.Interop.Excel.Workbook excelBook = null;
    try
    xlApp = new Microsoft.Office.Interop.Excel.Application();
    excelBook = xlApp.Workbooks.Open(FileName, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing);
    string[] excelSheets = new string[excelBook.Worksheets.Count];
    int i = 0;
    foreach (Microsoft.Office.Interop.Excel.Worksheet wSheet in excelBook.Worksheets)
    excelSheets[i] = wSheet.Name;
    i++;
    Dts.Variables["User::WorkSheetName"].Value = excelSheets[0] + "$";
    catch (Exception ex)
    excelBook.Close(false, FileName, null);
    Marshal.ReleaseComObject(excelBook);
    string error = ex.Message;
    finally
    excelBook.Close(false, FileName, null);
    Marshal.ReleaseComObject(excelBook);
    Dts.TaskResult = (int)ScriptResults.Success;

    I installed office in my machine...but this doesn't solved my problem...
    Finally i figured out the solution for this and it is working now, Here is the solution...!
    Create the folder with name "Desktop" inside the below mentioned path
    C:\Windows\SysWOW64\config\systemprofile\   
    But i really don't understand the logic behind this. Can someone explain it pls....

  • How Can I Run a SQL Loader Job from Schedular

    How Can I Run a SQL Loader Job from Schedular , So that It Runs every Day.

    Depends on a couple of factors.
    If you are on a UNIX platform, you can create a shell script and schedule it with cron.
    If you are on a Windows platform, you can create a batch file and schedule it with the Windows scheduler.
    Or, if you are on Oracle 9i or 10g, you could use the external table feature instead of SQL*Loader. Then you could write a stored procedure to process the external table and schedule it using the Oracle scheduler (DBMS_JOB). This would probably be my preference.

  • SQL Agent Job Fails To Run A SSIS Package

    Hi,
    I have a SSIS Package which basically truncates the table and re-loads it from an excel file .The job runs fine if i run it manually on visual studio.However, i try to shcedule a SQL Agent job and it fails with the following error
     Description: The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.  An OLE DB record is available.  Source: "Microsoft
    OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".  End Error  Error: 2014-10-22 14:47:41.15     Code: 0xC001002B     Source: Package1 Connection manager "Excel
    Connection Manager 1"     Description: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. 
    I am exactly not sure what it means?
    Can someone please help me with any suggestions on this.
    Thanks.

    Thanks for trying that option . It looks like there is an issue with the driver . Can you try to install/uninstall the driver once again from http://www.microsoft.com/en-us/download/details.aspx?id=13255.
    You can try this URL , where he has the similar problem 
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8a40d329-0611-44e2-ae51-3bd9b0901754/ssis-the-requested-ole-db-provider-microsoftaceoledb120-is-not-registered?forum=sqlintegrationservices
    Please mark this as answer if this helps to solve your problem

  • How to run long background jobs in ADF applications

    Hi,
    I'm looking for some guidance on how to run an asynchronous job within an ADF application with proper progress notification in the current page.
    Let's assume we have some long running task (e.g. generating notification emails from a bunch of rows in my view object and send them) with the corresponding classes implemented in the DataModel as part of the business logic (e.g. a class that sends a mail to a given recipient).
    Let's assume all the relevant methods can be exposed in the appmodule's client interface so they can be invoked from the ViewController if needed.
    In my jspx page I have implemented the standard af:poll+af:progressIndicator mechanism to give feedback about the running task, backed by a custom BoundedRangeModel
    with methods getValue() and getMaximum(). This works.
    However, all the examples I've found on the net are very very simplistic and only deal with simple counters or countdowns.
    But how to actually implement the whole mechanism in a real life scenario? How do I run the job itself and make it give feedback to my BoundedRangeModel class
    (which in turn is used by the progressIndicator on the page)?
    Is there a recommended way to do this within ADF apps? I've tried to search something about asynchronous method execution in ADF but there seems to be nothing out there.
    Do I need to use standard Java techniques such as a separate Thread running a Runnable worker? Should I use an observer/observable pattern to notify BoundedRangeModel
    and update its internal variables (current value and maximum)? Would this work across a Datacontrol interface?
    Is anything of this allowed within the ADF framework or I'm just gonna break the whole framework model because do-it-yourself concurrent programming isn't allowed in a multithreaded pooled environment?
    Some explanation about the current recommended best practices and/or some practical examples or articles about that would be great.
    (BTW: I'm using version 11.1.1.2.0 and yes, I've checked the contextual events thing too, but that's just an inter-page communication mechanism so it has has nothing to do with what I need to do.)

    Hi
    I have implement a "Runner" class to generate a pdf to every customer of a mailmerge file, which was uploaded. Its simply easy to do something like this. Just add a button, bound the button with a methode out of you applicationModule and start your implementing Thread in this methode.
    public class Runner implements Runnable {
        private String docFileName;
        private String csvFileName;
        private byte[] csvData;
        private byte[] docData;
        private FtpClient client;
        private String category;
        public Runner(String category, String docFileName, byte[] docData,
                      String csvFileName, byte[] csvData, FtpClient client) {
            this.category = category;
            this.docFileName = docFileName;
            this.docData = docData;
            this.csvFileName = csvFileName;
            this.csvData = csvData;
            this.client = client;
        public void run() {
    }In your applicationModule, you can start your Runner like this:
            Runner runner =
                new Runner(category, docFileName, docData, csvFileName, csvData, client);
            new Thread(runner).start();And to the problem with your progressBar. I would create a managedBean with a HashMap<String, HashMap<String, String>>. Every thread you start, add a HashMap<String, String> to this hashmap with the id of the username/session/whatever (must be bound to the user, which starts the thread). This added HashMap<String, String> should be used by your thread to put some status-information into. Now you can try to bind this info to your progressBar.
    I dont know if this will work, it is just an idea ;-)
    Regards
    Majo

Maybe you are looking for

  • External Hard-drive - not found in Finder/Desktop

    I've got a 1TB Toshiba hard-drive. When I connect it to my laptop, I can't find it in Finder or on the Desktop. I can find it in Disk Utility though, and it lights up and sounds like normal (that really really soft whirrring sound) Any ideas what is

  • Revised "Generate Excel Report" Example

    I recently answered a question from a Forum user about an error encountered when trying to generate an Excel spreadsheet with the Report Generation Toolkit.  I thought that the example code he was using was "unusual" and overly complex, and just disc

  • How do I determine what Cert Template is used by a Cert?

    Hi, The objective here is to understand what Certificate templates are used to issue certificates. We have a 2003 Sub Issuing CA which issues Certs to servers.  Im thinking the best way to see what template was used to issue this Cert is to go the De

  • Decoding the content (text/plain) for charset "iso-2022-jp"

    Hi there, I am using IMAP protocol to receive new email message and retrieving the contents using java mail API InputStream is = p.getInputStream() The part content type is text/plain and text/html and charset is "iso-2022-jp" The contents contain Ja

  • Open single record form for particular record

    It's simple to open tabular form for particular record - just add page item, pass value to this item and add this item to WHERE clause. But what is common approach for single record form? Where is it described?