Weird SQL Connection String problem?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Job Lot

    #1

    Weird SQL Connection String problem?

    I am connecting to my SQL database using following connection string

    Dim strSQL = "Persist Security Info=False;Inte grated
    Security=False; database=myDA;s erver=myServerN ane;User ID=;Password="
    Dim conn As New SqlConnection(s trSQL)

    conn.Open()
    conn.Close()

    The above code works fine, even if User ID and password are blank? How is it
    possible?

  • Chris Dunaway

    #2
    Re: Weird SQL Connection String problem?

    On Tue, 5 Oct 2004 06:29:03 -0700, Job Lot wrote:
    [color=blue]
    > I am connecting to my SQL database using following connection string
    >
    > Dim strSQL = "Persist Security Info=False;Inte grated
    > Security=False; database=myDA;s erver=myServerN ane;User ID=;Password="
    > Dim conn As New SqlConnection(s trSQL)
    >
    > conn.Open()
    > conn.Close()
    >
    > The above code works fine, even if User ID and password are blank? How is it
    > possible?[/color]

    Perhaps it's defaulting to a trusted connection or your SQL Server is set
    to allow Windows authentication?

    Just a guess.

    --
    Chris

    dunawayc[AT]sbcglobal_lunch meat_[DOT]net

    To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
    replace certain words in my E-Mail address.

    Comment

    • Morten Wennevik

      #3
      Re: Weird SQL Connection String problem?

      Hi Job,

      You use the integrated Sql Security to connect (no windows authentication)
      and I assume the Sql Server has a guest account enabled (anonymous). You
      may be able to connect, but the guest account quite often has no database
      access rights.

      --
      Happy Coding!
      Morten Wennevik [C# MVP]

      Comment

      • Nick Malik

        #4
        Re: Weird SQL Connection String problem?

        If you don't actually perform a SQL Command in between the Open and the
        Close, you would never know.

        ADO will not actually attempt to acquire a connection object until you need
        one. From the code you posted below, you don't need one.

        Put in a command object to do something trivial. Then your connection
        string will be validated.

        --- Nick

        "Job Lot" <JobLot@discuss ions.microsoft. com> wrote in message
        news:A94D37E3-F362-45A7-B7A1-29D4344EE461@mi crosoft.com...[color=blue]
        > I am connecting to my SQL database using following connection string
        >
        > Dim strSQL = "Persist Security Info=False;Inte grated
        > Security=False; database=myDA;s erver=myServerN ane;User ID=;Password="
        > Dim conn As New SqlConnection(s trSQL)
        >
        > conn.Open()
        > conn.Close()
        >
        > The above code works fine, even if User ID and password are blank? How is[/color]
        it[color=blue]
        > possible?
        >[/color]


        Comment

        • Morten Wennevik

          #5
          Re: Weird SQL Connection String problem?

          Hi Job,

          You use the integrated Sql Security to connect (no windows authentication)
          and I assume the Sql Server has a guest account enabled (anonymous). You
          may be able to connect, but the guest account quite often has no database
          access rights.

          --
          Happy Coding!
          Morten Wennevik [C# MVP]

          Comment

          Working...