Re: Password text is always shown in ConnectionString when an erro
From: Salvador Cadena (salvadorcadena_at_discussions.microsoft.com)
Date: 08/20/04
- Previous message: Val Mazur: "Re: Persisted Recordsets"
- In reply to: Val Mazur: "Re: Password text is always shown in ConnectionString when an erro"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Aug 2004 20:53:03 -0700
I'm using MDAC 2.7.
One more thing, the problem seems to be specific to ADO, I'm using the
same provider but with in C#, with OleDbConnection class, and could'nt
reproduce the problem.
Thanks a lot for being interested.
"Val Mazur" wrote:
> Interesting. I will try to reproduce to see if it is the same on my PC.
> Which version of MDAC (ADO) are you using?
>
> --
> Val Mazur
> Microsoft MVP
>
>
> "Salvador Cadena" <salvadorcadena@discussions.microsoft.com> wrote in
> message news:D483C252-F6B7-4E7C-A838-EA39809FC110@microsoft.com...
> > One more thing,
> >
> > If there isn't any error, in the code sample I wrote:
> >
> >
> > adoConn.Close '//Closes connection
> >
> > pwd = adoConn.Properties("password") '//pwd is blank, this is ok
> > MsgBox adoConn.ConnectionString '//sometimes in debug mode password
> >
> > if I supress the line:
> >
> > pwd = adoConn.Properties("password")
> >
> > the password text is shown anyway.
> >
> > It seems that the request of the password property clears the password
> > from
> > the connection string, so, after closing the connection with out asking
> > for
> > password property, the password text is shown too.
> >
> >
> >
> >
> >
> > "Salvador Cadena" wrote:
> >
> >> Thank you Val,
> >>
> >> I tried your suggestions, but, the problem persists. As I wrote, the
> >> problem
> >> happens only in after an error occurs. However its good to have your
> >> observations
> >> in mind, in order to improve our coding practices.
> >>
> >> "Val Mazur" wrote:
> >>
> >> > Hi,
> >> >
> >> > Since you specified Persist Security Info=false it should not show
> >> > security
> >> > information in your connection. I am afraid that declaring and
> >> > instantiating
> >> > of the connection causes it. Never declare ADO-related variable and
> >> > instantiate them in same line. It could lead to the memory leaks and
> >> > opened,
> >> > *lost* connections. Try to change your code to then next one to see if
> >> > it
> >> > helps
> >> >
> >> > Dim adoConn As ADODB.Connection
> >> > Dim rstConsulta As ADODB.Recordset
> >> >
> >> > Set adoConn = New ADODB.Connection
> >> > Set rstConsulta = New ADODB.Recordset
> >> >
> >> >
> >> > --
> >> > Val Mazur
> >> > Microsoft MVP
> >> >
> >> >
> >> > "Salvador Cadena" <salvadorcadena@discussions.microsoft.com> wrote in
> >> > message news:B44EDFFA-4394-4DFF-92F1-23A11264B9AA@microsoft.com...
> >> > > Does anybody know if this is a bug?
> >> > >
> >> > > Connection String is shown, password text included, whenever an error
> >> > > occurs,
> >> > > and after closing the connection. This behavior is the same with
> >> > > MsDaOra
> >> > > and
> >> > > SQLOLEDB OLE Providers.
> >> > >
> >> > > The following code shows how to reproduce the problem:
> >> > >
> >> > > private sub tryConnection()
> >> > > Dim adoConn As New ADODB.Connection
> >> > > Dim sSql As String
> >> > > Dim rstConsulta As New ADODB.Recordset
> >> > > Dim pwd As String
> >> > > On Error GoTo ErrorHandler
> >> > > sSql = "select Count(*) from K_User " '//Change this for a valid
> >> > > statement, and
> >> > > '//everything will go fine, leave it as is, and you will be
> >> > > reproducing
> >> > > the
> >> > > problem
> >> > >
> >> > > 'Open the connection using Persist Security Info=false
> >> > > adoConn.Open ("Provider=SQLOLEDB;Data Source=localhost; User
> >> > > ID=acdev;
> >> > > Password=acdev; Initial Catalog=Keyadmin40; Persist Security
> >> > > Info=false;")
> >> > >
> >> > > pwd = adoConn.Properties("password") '//pwd is blank, this is ok
> >> > > MsgBox adoConn.ConnectionString '//password text is not shown,
> >> > > this is
> >> > > ok
> >> > >
> >> > > rstConsulta.Open sSql, adoConn '//Executes ok
> >> > >
> >> > > adoConn.Close '//Closes connection
> >> > >
> >> > > pwd = adoConn.Properties("password") '//pwd is blank, this is ok
> >> > > MsgBox adoConn.ConnectionString '//sometimes in debug mode
> >> > > password
> >> > > text
> >> > > is shown, this is bad
> >> > >
> >> > >
> >> > > Set adoConn = Nothing
> >> > >
> >> > > Exit Sub
> >> > >
> >> > > ErrorHandler:
> >> > > '//If an error occurs, for example the table name on the sSql
> >> > > string
> >> > > '//does not exist
> >> > > MsgBox Err.Description
> >> > > MsgBox adoConn.ConnectionString '//password text is not shown,
> >> > > this is
> >> > > ok
> >> > > adoConn.Close
> >> > > MsgBox adoConn.ConnectionString '//password text is SHOWN, this is
> >> > > really bad
> >> > >
> >> > >
> >> > >
> >> > > End Sub
> >> > >
> >> >
> >> >
> >> >
>
>
>
- Previous message: Val Mazur: "Re: Persisted Recordsets"
- In reply to: Val Mazur: "Re: Password text is always shown in ConnectionString when an erro"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|