May 24, 2010 at 8:28 am
DECLARE @result int
EXEC @result = master..xp_cmdshell 'C:\AYSS\encrypt_by_GPG.bat'
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'
return
the results are:
NULL
C:\WINNT\system32>rem encrypt file
NULL
C:\WINNT\system32>cd c:\program files\GNU\GNUPG
NULL
C:\Program Files\GNU\GnuPG>gpg -r abc@ccc.com --encrypt c:\ayss\ayss.txt
gpg: abc@ccc.com: skipped: public key not found
gpg: c:\ayss\ayss.txt: encryption failed: public key not found
NULL
If the batch file 'encrypt_by_GPG.bat' is run by double-clicking on it. It runs well and the file is encrypted and generated. However, if you run it through MS SQL master..xp_cmdshell, I got public key not found error.
May 24, 2010 at 8:50 am
Does GPG store the encryption keys in the registry for each user? If so, then are you testing it using the same account that is running the SQL Server service?
Also, have you considered using an SSIS package to do these sorts of tasks? It's a lot safer and I guess you're probably going to be moving files around/ftp'ing after this, which is all a lot less hassle in SSIS.
May 24, 2010 at 8:59 am
Are those results from you running the file or SQL Server? I'd agree with the post above that you might have user issues from the SQL Service account, or the XP_CMDSHELL proxy.
Follow me on Twitter: http://www.twitter.com/way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
May 24, 2010 at 11:04 am
yea that was it. Thanks guys. I should have known that. I had the same issue in the past when implimenting SFTP.
Thanks for your help and timely response!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply