Connect to OLEDB for SQL Server and ODBC

This article describes how connections can be establish with data base with OLEDB provider and ODBC drivers.
  • 1936

Introduction

OLEDB connection class that calls the underlying OLE DB Provider can be wrap with connection string

Provider=SQLOLEDB;Data Source=server_address;Initial Catalog=database_name;User Id=user_name;Password=password;

ODBC Driver

ODBC stands for Open Data Base connectivity. It is used for accessing data in heterogeneous environment of relational and non-relational database management systems. ODBC is a Microsoft strategic interface. ODBC provides an open, vendor-neutral way for accessing data. For ODBC server we required ODBC driver. The ODBC driver catalog contains an extensive listing of ODBC Drivers. Connection string used to connect to database is

Driver={Sql Server};Server=server_add;Database=database_name;uid=user_name;pwd=password;

Trusted connection is like window authentication. It is very secure to create this connection to connect with the database.

Trusted connection utilizes the user's windows username and password to access the database. Trusted connection can be created with the connection string

Driver={SQL Server};Server=server_add;Database=database_name;Trusted_connection=Yes;

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.