Help Connecting to SQL Server | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Help Connecting to SQL Server

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 />
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
Using Roles / Group this can be achived. hsGoswami
[email protected]
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.
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.
Also check your sql server is running in mixed mode authentication, and not just Windows auth & for more information in addition what said abvoe. Satya SKJ
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
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