Connection Strings

Some typical connection strings.


ODBC – Access data source
{Microsoft Access Driver (*.mdb)};Dbq=C:\demo.mdb;Uid=Admin;Pwd=; 

ODBC – Excel data source
Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\directory;

ODBC – Oracle data source
Driver={Microsoft ODBC for Oracle}; Server=myservername;Uid=myusername;Pwd=mypassword;

ODBC – SQL server data source – Database Login
Driver={SQL Server};Server=myservername;Database=mydemodb;Uid=myusername;Pwd=mypasswd; 

ODBC – SQL server data source – Trusted Connection
Driver={SQL Server};Server=mysername;Database=mydemodb;Trusted_Connection=yes;

OLEDB – Access data source
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\directory\demo.mdb;User Id=admin;Password=;

OLEDB – Excel data source
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties='"Excel 8.0;HDR=Yes;IMEX=1"'

OLEDB – Oracle data source
Provider=msdaora;Data Source=mydemodb;User Id=myusername;Password=mypasswd;

OLEDB – SQL server data source – Database Login
Provider=sqloledb;Data Source=myservername;Initial Catalog=mydemodb;User Id=myusername;Password=mypasswd; 

OLEDB – SQL server data source – Trusted Connection
Provider=sqloledb;Data Source=myservername;Initial Catalog=mydemodb;Integrated Security=SSPI;

SQLSERVER – SQL server data source – Database Login
Server=myservername;Database=mydemodb;User ID=myusername;Password=mypasswd;Trusted_Connection=False 

SQLSERVER – SQL server data source – Trusted Connection
Server=myservername;Database=mydemodb;Integrated Security=SSPI;

ORACLE – Oracle data source
Data Source=mydemodb;User Id=myusername;Password=mypasswd;Integrated Security=no;
Note: You can use Visual Studio “Server Explorer” Browser to connect to the Data Sources, and perform management tasks. The connection string is available in the Properties pane for a given connection: