SQL Server Performance

Help Connecting to SQL Server

Discussion in 'Non-Transact SQL Developer Performance Tuning' started by rcatiggay, Jun 2, 2005.

  1. rcatiggay New Member

    Below is a snipet of code that I use to connect to a sql server database via my application. It works fine if the user logged into windows has administrator priviledges. However if the user is logged in with anything less than administrator priviledges say Power User, a connection dialog gets displayed everytime the application tries to connect to the database. The user permission in the application has no relevance. Any ideas as to how to tweak the connection string that I am passing in to prevent the connection box from appearing at all.<br /><br /><br />Thanks in advance;<br />Rodney<br /><br /><br /><br /><br /><br />strConnect.Format("Driver={SQL Server};user id= %s<img src='/community/emoticons/emotion-4.gif' alt=';p' />assword=%s;database=avidian;server=%s",strUserName,strPassword,strServer);<br /><br /> <br /><br /> try<br /><br /> {<br /><br /> sqlHandle-&gt;OpenEx(strConnect, CDatabase::useCursorLib);<br /><br /> }<br /><br /> catch(CDBException* pEx)<br /><br /> {<br /><br /> strMessage = "Could not open the database:

    ";<br /><br /> strMessage += pEx-&gt;m_strError;<br /><br /> LogAddEntry(strMessage, slWarning,false);<br /><br /> pEx-&gt;Delete();<br /><br /> return false;<br /><br /> }<br />
  2. dineshasanka Moderator

    You have to give access privileges to that user for the required objects,
    check whether that specific user has rights on needed tables and sps and others

  3. ghemant Moderator

    Using Roles / Group this can be achived.

    hsGoswami
    ghemant@gmail.com
  4. rcatiggay New Member

    We have a hard coded username and password that we use.
    For example username: test password: Abc=123
    These credentials are used to connect to the database all the time regardless of who is connected to our application.

    The issue I am having is that when a user with Administrative priviledges on the Windows XP workstation uses the application it works fine the application login in seamlessly and I can see the user test is logged on to the database. If we reboot the workstation and login in with a user that only has Power User priviledges and attempts to run the application the user is prompted to enter user credentials whenever the application attempts to connect to the database.


    I'll look into Roles and Groups to see if that works.

    Thanks in advance for your efforts.
  5. Adriaan New Member

    Does the user with administrator privileges on the workstation have the same on the SQL Server computer, or on the network? On lots of installations you see that local/network administrator groups have sysadmin access to SQL Server - obviously this is not recommended.

    The connection string from your code doesn't specify SQL or Windows authentication: not sure, but the server may be assuming a Windows login (ignoring the user name and password specified) - that would work for an administrator but not for a regular user.
  6. Chappy New Member

    Also check your sql server is running in mixed mode authentication, and not just Windows auth
  7. satya Moderator

  8. Akthar New Member

    if you are running on Windows Auth, you have to specify Integrated Security=SSPI in your connection string.
    But if SQl Auth, then non need

    AKTHAR DILMOHAMUD
    65 BENARES ST
    PORT LOUIS
    MAURITIUS

Share This Page