Data Access Worldwide Knowledge Base
Article ID 2227 Article Title INFO: Using the Login Command with Trusted_Connection in MSSQL Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2227 KBase Category CONNECTIVITY KITS Date Created 06/23/2006 Last Edit Date 06/23/2006
Article Text
QUESTION:
How do I log in from my application using Trusted_Connection with the SQL Connectivity Kit?
ANSWER:
If you want to connect to your SQL Server database using Windows Authentication (trusted connection), you do not need to use the Login command; you can have your (table) INT files set to use Trusted_Connection and the login will happen automatically.
In the example below, the application will use trusted connection and open the "Customer" table using the Windows login information the user typed in to log in to Windows:
// Customer.INT
DRIVER_NAME MSSQLDRV
SERVER_NAME SERVER=MyServerName;Trusted_Connection=yes;DATABASE=MyDBName
DATABASE_NAME Customer
SCHEMA_NAME dbo
If you really want to use the Login command (you might want to create a Login dialog and give your users the option to use trusted connection or not), the Login needs to specify Trusted_Connection in the Server_Name argument:
// note that the user and password are null, i.e. just two double-quotes
Login "SERVER=MyServerName;Trusted_Connection=yes;DATABASE=MyDBName" "" "" "MSSQLDRV"
and the table INT should have the following as SERVER_NAME:
SERVER_NAME SERVER= MyServerName;DATABASE=MyDBName
Using the previous example, Customer.int would have to be changed to:
DRIVER_NAME MSSQLDRV
SERVER_NAME SERVER=MyServerName;DATABASE=MyDBName
DATABASE_NAME Customer
SCHEMA_NAME dbo
More information and other variations of the Login command and INT file, like not specifying the database name along with the server name in the INT file, can be found in the help under "User Information Outside .INT File".
Contributed By:
Marcia Booth
Company: Data Access Worldwide
Web Site: http://www.dataaccess.com
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.