Is it advisable or practical to run SQL Agent with Account from another domain?

A SQL Server in domain A needs to mount databases downloaded on a weekly basis to a second SQL Server, in domain B.
Right now, the two domains, which were deliberately separated for security, have no trust.
Currently, a manager of the server in domain A uses credentials in domain B to logon to domain B and do a file copy of the databases, which he then mounts on the server in domain A.
Having noticed that the best way to place a copy of a database onto a remote server is via SQL backup, as opposed to a file copy, because it is five times faster, and suspecting that a SQL restoration
operation might be as much faster than the current file copy from domain B to A, the idea has been floated that the SQL Agent in domain A could schedule a restoration from databases residing on the hard drive of the server in domain B.
Can credentials of an account in domain B be used to drive the SQL Agent on the server in domain A, and if so, does this require the establishment of a trust? I suspect that it would, although
once a user of the server in domain A establishes a connection to a file share in domain those credentials are cached for future use.
Would using an account in domain B to logon the SQL Agent in domain A -- with or without a trust -- cause all the jobs in domain A to fail on the grounds of missing permissions?

Thank you for your prompt reply.
The FTP download seems technically feasible. But, I think, the FTP transfer would not provide the speed our organization has been looking for. We are making do with 100Mbps where we actually
need 1Gbps.
The SSIS proposal is not feasible because a trust between the two domains would not be allowed. In any event, if it were a straight file copy, not a SQL backup, we would not obtain the speed
we seek. You mention, in this context, a 'file copy.' Is this a simple copy from an arbitrary TCP port on Server B to port 445 on server A, or is it a different type of copy, such as that used when a SQL runs a backup job to a network destination?
What do you think of this: in domain B, where the files reside, use the proxy account to run a backup job to the server in domain A. That would give us the speed we need. But that would also
require a trust, wouldn't it? Is there any way to get around the need for the trust? If the backup job could run from server in domain B to the server in domain A, another job could be setup on server in domain A to complete the restore.
When I create the SQL Proxy, do I supply the name of the account in the trusting domain?  When I look at the dialog for the creation of the "new proxy account" on a server without trust
connections, I am offered only two GUIDs as candidate proxies.  Would that change once I create the trust, and would I be allowed to browse accounts in the trusting domain?
Are you familiar with the dramatic advantage taht a SQL backup job holds over a copy of files from point A to point B? It's something like ten times faster.
Yours,
Bob Hindla.

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

  • SQL agent proxy account for Powershell

    I am trying to use a sql agent proxy account for PowerShell. Created the ad account, credential and the proxy but because the PowerShell accesses a bunch o sql servers it errors out.Even when I created a login for all the sql servers the powershell is trying
    to access it still failed so next I'd need to look at what permissions the powershell ad account needs to the objects it accesses. Is this the correct approach?
    What is the best way to go here and avoid using a sysadmin account to run the sql agent powershell job? Thanks!
    Paula

    Hi,
    Please check the error message in job history for details of job failed.
    Sysadmin is required or not depends on what you want to achieve on the SQL Server. For example, to execute sp_readerrorlog, the login must be a member of the securityadmin role and it is not required sysadmin.
    It does need to create the login(proxy account) on the all the SQL Server instances.
    A SQL Server Agent Proxy defines the security context under which different job steps run. The proxy contains the credentials of a Windows user account that does have access to the resources needed by the job. If you have a proxy specified in a job step, SQL
    Server Agent will impersonate the proxy account and run the job step while impersonating that user account.
    In order to find out the required permission, you may log in with this Windows user account(proxy credential) and run the PowerShell on the local machine and see the result. Alternately, connect in SQL Server Management Studio with this login and see what
    permission is required to execute the script.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Populate SQL table with data from Oracle DB in ODI

    Hi,
    I am trying to populate a source SQL table with fields from an Oracle db in ODI. I am trying to perform this using a procedure and I am am getting the following error:
    ODI-1226: Step PROC_1_Contract_Sls_Person_Lookup fails after 1 attempt(s).
    ODI-1232: Procedure PROC_1_Contract_Sls_Person_Lookup execution fails.
    ODI-1228: Task PROC_1_Contract_Sls_Person_Lookup (Procedure) fails on the target MICROSOFT_SQL_SERVER connection Phys_HypCMSDatamart.
    Caused By: weblogic.jdbc.sqlserverbase.ddc: [FMWGEN][SQLServer JDBC Driver][SQLServer]Invalid object name 'C2C_APP.CON_V'.
    My question is what is the best method to populate SQL db with data from an Oracle db? Using a procedure? A specific LKM?
    I found threads referring to using an LKM to populate Oracle tables with data from a SQL table....but nothing for the opposite.
    Any information would help.
    thanks,
    Eric

    Hi Eric,
    If using an Interface, I would recommend the LKM SQL to MSSQL (BULK) knowledge module. This will unload the data from Oracle into a file, then bulk load the staging db on the target using a BULK INSERT.
    Regards,
    Michael Rainey

  • Running SQL developer with Oracle XE

    I am running SQL Developer 1.5 against Oracle 10g XE for a quick interface to practice SQL and PL/SQL. Before running any scripts to create tables, I see a huge number of tables, views, etc. already created for my user HR (which I unlocked in Oracle XE) and any other user I create. What can I do to prevent these tables from appearing? Which ones are necessary for processing? I realize that these are old versions of SQL Developer and Oracle XE but they are much quicker to install for my purposes than the newer editions. Thank you.

    Get the latest SQL Developer instead right away; it's no "install" just unzip and go.
    Above suggested role, is one of the predefined, to-be deprecated roles, and should not be used. Instead use CREATE SESSION privilege for relevant users and preferrably create your own application-specific roles. See the Security Guide for more info.

  • SQL server agent job running as Agent Service Account whose service account does not have r/w access but is still able to write?

    Hi. I am newer to SQL server security and am reviewing some of our SQL server's configuration to make sure the services are running under accounts with least privilege.  I have a SQL server 2012 instance whose Agent service is configured to run
    under an AD user account named 'SQLServices'.  The jobs on this server are configured to run as 'SQL server agent service account', which means they should execute as user 'SQLServices'.  The jobs are set up to execute SSIS packages which read and
    write to a database on the same server where the agent job is scheduled and SSIS package installed (all on same server).  The jobs are currently executing without error and are reading writing data correctly.  Upon close examination, it turns out the
    SQLServices account is not assigned to the 'sysadmin' role and had no users mapped to any databases on this server.  How are these jobs working?  I verified in profiler that the login name indeed is 'SqlServices'.  I also verified
    that SQLServices login has no database access by remote-ing onto the server and trying to log into the DB, and access was denied as expected.  According to the literature, the Agent service needs to be a member of 'sysadmin role' but I am reading
    some cases where that is not necessarily the case.  So this is not so concerning.  What is concerning is that the login 'SQLServices' had no access to the databases on that server yet it is reading and writing to the databases as if it does. 
    The only thing I can think of is maybe jobs run as 'SQL server agent service account' on the same server as the databases it r/w to somehow has some kind of default access.  What am I missing here?  Any input would be helpful.

    After 2 days on this forum I found the answer to my own question.  In retrospect, I should have posted this under 'SQL Server Security', but I didn't know it existed.
    The 2 threads below explain that Sql agent actually runs using SID (service) NT SERVICE\SQLSERVERAGENT if you chose that when you installed.  This will automatically create an associated login NT SERVICE\SQLSERVERAGENT in SQL server with sqladmin
    role.  This is the login that Agent uses to connect to the local instance of SQL server.  If you changed to domain account to run the service during install or after using config manager, basically NT SERVICE\SQLSERVERAGENT is still
    used to connect to your local instance behind the scenes (even though you will still see your domain user as account), and the domain account is used to reach outside the server. 
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6bb2de-8fd0-45de-ab02-d59bbe05f72e/servicedatabase-accounts-nt-servicemssqlserver-nt-servicesqlserveragent-what-are-they-for
    https://social.technet.microsoft.com/Forums/sqlserver/en-US/b83a52fd-fe11-4c28-a27b-88be8ae79f2a/how-do-i-change-sql-server-agent-service-account-to-nt-servicesqlserveragent?forum=sqlsecurity

  • 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

  • Unable to bulk copy data. - Random failure, running as SQL Agent with Admin rights and timeouts=0

    Hello,
    My setup is SQL Server 2012 (11.0.5522) and SSIS, but still running the 2008 R2 created packages. The server is Windows Server 2008 R2 with 32GBs of memory.
    I am running a control package which calls 4 packages at once to run simultaneously for performance reasons. It runs every day with issues, but maybe once a month I get the failure:
    'Unable to bulk copy data. You may need to run this package as an administrator.'
    The SQL Agent is setup as admin, it has access to the create global objects the source and destination databases are on the same server and the timeout is set to zero. Each package has the standard batch size and takes about 3-4 minutes to complete.
    Its not easily re-creatable and always runs fine when I re-start the package.
    Any help would be appreciated.
    Kind regards, Graham.

    see
    https://popbi.wordpress.com/2012/09/03/ssis-unable-to-bulk-copy-data-you-may-need-to-run-this-package-as-administrator/
    https://support.microsoft.com/kb/2216489?wa=wsignin1.0
    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

  • Is it possible to run SQL*Plus with Putty?

    Hello everybody,
    I've just installed Oracle 11g on Windows Vista. When I click on SQL*Plus it opens the program in the default windows command line. I don't really like the look and feel of cmd. I would like to know whether it is possible to run SQL*Plus in a more advanced/user friendly environment such as Putty terminal client.
    Thanks in advance,
    Dariyoosh

    Kamran Agayev A. wrote:
    user8747515 wrote:
    Windows Command Line is ace! Arrow Up & Down to retrieve commnads... you don't get that (not without a rubbishy workaround) in UNIX!You can solve this issue using rlwrap package. See my vide tutorial
    http://kamranagayev.wordpress.com/2009/07/04/using-rlwrap-to-get-command-lines-history-in-sqlplus-video-tutorial/
    Dear Kamran,
    Thank a lot for this nice presentation, I had also this problem (no command history) under linux. This package is really interesting.
    Kind Regards,
    Dariyoosh

  • 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

  • Need to run SQL jobs with Non Sys-Admin account

    Hi Everyone,
    We've recently asked to switch our SQL service account from an account having sysadmin permissions to a non sys-admin account. Could you please give us any inputs on this.
    Thanks in advance. :)

    It's a little difficult to understand what you are talking about. First you say:
    We've recently asked to switch our SQL service account from an account having sysadmin permissions to a non sys-admin account. Could you please give us any inputs on this.
    No, the service account for SQL Server should not be a Windows administrator. It should be a standard Windows account. When you enter this account in SQL Server Configuration Manager, SSCM will assign the required permissions. You should then also assign
    the permissions "Lock pages in memory" and "Perform volume maintenance tasks".
    But then you start to talk about proxies and whatnots, and this is where you lose me entirely. Could you clarify what you are talking about?
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Execute SQL Task with Parameter - from DB2 to SQL Server

    I am pulling data from DB2 to SQL Server.
    1st Execute SQL task runs the following against DB2:
    SELECT TIMESTAMP(CHAR(CURRENT_DATE - (DAY(CURRENT_DATE)-1) DAYS - 1 MONTH)) as START_MONTH
    FROM SYSIBM.SYSDUMMY1;
    I'm storing it as a Result Set.
    Next I have a Data Flow Task.  This pulls data from DB2 where the date matches the parameter.
    FROM SCHEMA.TABLE t
    WHERE DATE_TIME_COLUMN= ?
    This works fine. Guessing, because the parameter source is DB2 and the Data Flow source is DB2.
    The problem is, I want to remove existing data for the same date in the SQL table.  IE, if I'm pulling March 2014 data from DB2, I want to be sure there is no March 2014 data in the SQL table.  The main use is for re-runs.
    So, I added another Execute SQL task after the first one that assigns the variable, and before the Data Flow Task. This runs the following statement against SQL Server:
    DELETE FROM
    database.dbo.table
    WHERE DATE_TIME_FIELD >= ?
    The package fails at the new Execute SQL Task with the following error message:
    Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "DELETE FROM
    SBO.dbo.tblHE_MSP_FEE_BUCKETS
    WHERE T..." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
    correctly.
    Task failed: Execute SQL Task
    SSIS package "Load_MSP_Fee_Buckets_SQL.dtsx" finished: Success.
    The program '[14240] Load_MSP_Fee_Buckets_SQL.dtsx: DTS' has exited with code 0 (0x0).
    I am assuming this is something to do with the Parameter source being DB2, and trying to use against SQL?
    Any suggestions on how to make this work??
    Thanks,
    -Al H

    Parameter name is unrecognized
    is the key, how come DB2 is related if it runs against SQL Server
    What I think is happening you do not use the OLEDB connection to SQL Server.
    Likewise, if it is ADO then the query needs to be
    DELETE FROM
    database.dbo.table
    WHERE DATE_TIME_FIELD >= @MyDate
    Arthur My Blog

  • How to call sql procedure with parameter from java

    Hello,
    i am trying to call one sql procedure with two parameters from java.
    the first parameter is In parameter, the second is OUT.
    the return value of this java method should be this second parameter value.
    the following is my java code:
    protected String getNextRunNumber() {
         String runnumber=null;
         String sql = "{call APIX.FNC_SST_EXPORT.GET_NEXT_RUNNUMBER (?,?)}";
    CallableStatement state = null;
    try{
         Connection con= getDatabaseConnection();
         state = con.prepareCall(sql);
         state.setString(1, m_appKeyExport);
         state.registerOutParameter(2,Types.NUMERIC,0);
         state.execute();
    ResultSet resultR = (ResultSet)state.getObject(2);
         while (resultR.next()) {
              runnumber=resultR.getBigDecimal(1).toString();
    catch (SQLException e){System.out.println("You can not get the export next run number properly");}
    return runnumber;
    i got error message like:
    java.lang.ClassCastException: java.math.BigDecimal
    As far as i knew, if the parameter is number or decimal, we should give also the paramer scale to the method: state.registerOutParameter(), but i still get this error message.
    Please help me to solve this problem.
    Thanks a lot.

    state.execute();
    i try to use debug to find the problem, in this line, i saw
    OracleCallableStatement(OraclePreparedStatement).execute() line: 642 [local variables unavailable]
    is this the problem?

  • Can not use stored windows credential when running merge agent with agent proxy

    I have an account ACCT_A and create a windows credential
    CRED_B target to server DISTRIBUTOR_1 (with cmdkey). 
    And I setup a pull subscription to DISTRIBUTOR_1 and set merge agent run under agent proxy with credential of account
    ACCT_A (The sql server agent is running as LocalSystem or Network Service). Then the merge agent job will failed and complain "Failed to connect to distributor
    DISTRIBUTOR_1".
    However if I change the sql server agent to run as ACCT_A and let merge agent job run as SQL Server Agent Service Account it will successfully connect to distributor
    DISTRIBUTOR_1 with credential CRED_B, with other setting unchanged. 
    Here are the questions:
    Is it possible to grant other accounts to access one's stored windows credential in Credential Manager?
    I suppose merge agent job will get full security context of ACCT_A when it runs under agent proxy with credential of ACCT_A and should be able to access stored credential CRED_B and
    successfully connect to DISTRIBUTOR_1. But nowCRED_B seems can not be accessed by merge agent. Could somebody explain what's the problem here? 

    Hello,
    I am currently looking into this issue and will give you an update as soon as possible.
    Thank you for your understanding and support.
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here.
    Fanny Liu
    TechNet Community Support

Maybe you are looking for

  • Tips&Tricks How to use Final Cut and Color !

    Hello , Final Cut - Color - Back to Final Cut After many days of trying to get this combination working I have found a non-Color-Final Cut way : 1)After you final cut picture edit is locked you have to clean as much as possible the timeline . That me

  • Receiver File Adapter Content Conversion Problem.

    Hi All, I am getting in receiver file adapter due to content conversion setting. Problem is that all the fields coming in file adapter are optional. In content conversion , i have specified fieldfixedlengths. So whenever any optional field is not pre

  • JDeveloper with JDK 1.4

    Preferences dialog is not working with my installation of J2SE 1.4 on RedHat Linux 7.3. It suppose that it should not matter that it is 1.4 instead of 1.3.1? Any ideas? I tried couple of other things with JDeveloper and they seem to be working. Thank

  • Flash Builder 4.7 Mac DMG Invalid Checksum

    When I download the FB 4.7 for mac from here and try to open it on Mountain Lion I get an "Invalid checksum" error. Here's the link I'm using once I login: http://www.adobe.com/cfusion/entitlement/index.cfm?event=custom&loc=EN_US&sku=FS0003374&e= lab

  • Program Crash! HELP!!

    Okay... I have a HUGE problem with my Photoshop Elements 9.0 I use Photoshop when I draw. And when I work the program suddenly crashes. It happens really often. Like every 5 minutes when I work. I tried to re-install the program. But it didnt work! P