September 22, 2005 at 10:41 am
I have a problem,
I have run a series of bcp statement (in automatic way, running a stored proc), to run they need password.
The problem is:
how can pass the encrypted password from sql to BCP with the command :
EXEC @RetError = master..xp_cmdshell @RunCmd
where @runcmd is the bcp command: bcp "celect * from table1" queryout "c:\pippo.dat" -n -S . -U sa -P encrypted password
Because I don't want to leave password as clear text in the procedure.
Thank
Any help will be appreciated
September 22, 2005 at 10:53 am
Use trusted connection (-T).
September 22, 2005 at 11:45 pm
And don't use "sa".
_____________
Code for TallyGenerator
September 23, 2005 at 3:34 am
Hi,
I used - T arguments, but:
if the bcp is run directly on the windows command prompt, it works.
if the bcp is run from sql : EXEC @RetError = master..xp_cmdshell @RunCmd from the stored proc, the following error occur:
SQLState = 28000, NativeError = 18456
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'.
NULL
Do you vave any suggestions?
September 23, 2005 at 3:47 am
Check the account started MSSQLSERVER.
It must be "Local System Account".
Change it to proper account and try not to use Local System Account to start MSSQLSERVER anymore.
_____________
Code for TallyGenerator
September 23, 2005 at 5:09 am
My config are:
SQL Server properties (configure) local (tab: security):
- SQL server authentication
Start service account: Start and run SQL server in the following account:
- system account.
Registered SQL Server Properties:
Use SQL server properties
- Use SQL server authentication
September 23, 2005 at 5:29 am
System account is not the right account to start SQL server. The are many issues corresponding to this option. If you want you can make a quick research and find a lot of articles about this.
If you run SQL Server from, say, your account you'll neve get that issue.
_____________
Code for TallyGenerator
September 23, 2005 at 12:04 pm
SQL Server service account should not be LocalSystem nore local computer accounts. They need to be domain user acconuts that are in the LocalAdministrators security group. As an additional security best practice you remove 'interactive logon' from these service accounts. As for passing bcp an 'encryptd ' password, there is no such support for this. Your best bet is using the -T flag (trusted connection). If you set up your services as stated earlirt, then you should have no issues.
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
September 26, 2005 at 2:59 pm
You can create stored procedure with encription.
September 26, 2005 at 4:02 pm
Just a quick thought on 'encryption' ... there are lot's of 'freebies' on the web for 'decryption' and a few 'pay for' packages as well. In SQL 2000 encryption is definitely NOT 'hack-proof'. If you are going to want something like this you'll have to wait for SQL 2005. It's enryption is much more solid and comprehensive.
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
September 27, 2005 at 7:11 am
Just a quick thought... why does the BCP login/password need rights to anything but the destination table? Make a user that only has rights to the input staging table (you ARE using a staging table, aren't you?) just for this BCP job. Once you've transferred the data out of the staging table, truncate it to remove the data and then who cares if someone get's the login?
--Jeff Moden
Change is inevitable... Change for the better is not.
September 27, 2005 at 11:40 am
create proc p_bcpPassword @pwd varchar(15) output WITH ENCRYPTION
as
select @spwd = 'bcppasswordhere'
return
EXEC Master..P_BcpPassword @SPwd out
select @command = 'bcp.............-P' + @spwd + '........'
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply