Saturday, February 25, 2012

Connection string with sa password

My application designed with VB6.0 is connected to MS SQL Server 7.0.
Server has password for sa login. The VB code for connection is next:
Dim Conn As ADODB.Connection
Set Conn = New ADODB.Connection
Conn.ConnectionTimeout = 30
Conn.ConnectionString = Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;Initial Catalog=master;Data
Source=server;Password=mypassword;
Conn.Open
Connection performs successfully but after that Conn.ConnectionStrring
value has changed and equals
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial
Catalog=master;Data Source=retiv;Use Procedure for Prepare=1;Auto
Translate=True;Packet Size=4096;Workstation ID=USER;Use Encryption for
Data=False;Tag with column collation when possible=False
There is no any information about sa password which is not blank.
Connection object Conn is a global object in my application which is
used after, so I get a error
Login failed for user sa
How can I save my sa password in connection string?First of all, you shouldn't be using 'sa' to connect to SQL Server, from
your applications. This is a security threat, as 'sa' happens to be a
powerful login.
Then, you should be either using a DSN, or store your connection string
somewhere (Global.asa may be?), so that it is there at a specific location,
and that it never changes.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Vadim Bulat" <bulat@.asuxxivek.spb.ru> wrote in message
news:7e1d1f98.0407150731.78249213@.posting.google.com...
> My application designed with VB6.0 is connected to MS SQL Server 7.0.
> Server has password for sa login. The VB code for connection is next:
> Dim Conn As ADODB.Connection
> Set Conn = New ADODB.Connection
> Conn.ConnectionTimeout = 30
> Conn.ConnectionString = Provider=SQLOLEDB.1;Persist Security
> Info=False;User ID=sa;Initial Catalog=master;Data
> Source=server;Password=mypassword;
> Conn.Open
> Connection performs successfully but after that Conn.ConnectionStrring
> value has changed and equals
> Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial
> Catalog=master;Data Source=retiv;Use Procedure for Prepare=1;Auto
> Translate=True;Packet Size=4096;Workstation ID=USER;Use Encryption for
> Data=False;Tag with column collation when possible=False
> There is no any information about sa password which is not blank.
> Connection object Conn is a global object in my application which is
> used after, so I get a error
> Login failed for user sa
> How can I save my sa password in connection string?

No comments:

Post a Comment