Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2005
    Posts
    25

    Unanswered: restriced access

    HI,

    how can i restrict the access for my sqlserver DB.
    I can connect with any Connection STring.
    What do i have to change so that u can only access the db with the correct username and password from an app?


    thats my connString.
    "Data Source=TURM21;Database=Db1;User id= kr; password=hahn; Trusted_connection= true;pooling=false;"

    Is it a Property Setting in Sql Server? Where is this Setting?

    Greetz

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    You have two security settings in SQL Server:
    Windows Authenication Only and mixed (Windows and SQL Server). Make sure you are set to use both.

    Your connection string includes:
    Trusted_connection= true
    This means that your NT log is used to access SQL Server. The username and password you supply are ignored. It is your NT account that is giving you access to the server. Remove this from your connection string and the SQL Server username and password you supply will be used to authenticate you.

    BTW - MS recommend you access SQL Server using your NT credentials.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Nov 2005
    Posts
    25
    ok i switched to mixed authentification.

    my connection string is:

    Data Source=TURM21;Database=Db1;User Id=kroete;password=hahn;pooling=false;

    the user was createdlike this:

    CREATE LOGIN kroete
    WITH PASSWORD = 'hahn';
    use Db1;
    create User kroete;
    GO

    But now i get an SQLException: error during login;

    I don't know what the problem is?

    Cheers
    Last edited by Crean; 06-02-06 at 12:15.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Apart from your userID changing from the first post?

    Double check your password (not what I'd describe as strong BTW). Try logging via QA with those credentials. If you succeed then it is probably the client code. If you fail then your username\ password are wong.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Nov 2005
    Posts
    25
    no the user id is correct

    Ok i tried to connect directly (Sql Server Management Stduio) wit Sql Server Authentification and i can not connect.

    Is the way, I created the user correct?

    CREATE LOGIN kroete
    WITH PASSWORD = 'hahn';
    use Db1;
    create User kroete;
    GO

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    ok - what's the exception description then?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    You forgot FROM clause in your CREATE USER statement.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  8. #8
    Join Date
    Nov 2005
    Posts
    25
    From clause? Why? And how?
    Will post the exception later. Don#T have it here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •