0% found this document useful (0 votes)
146 views

Connection Strings

Database Connection String, ADO.net, MySQL, Oracle, MS SQL Server, MS Access, Password protected databse connection, Using ADO.net with any database
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Connection Strings

Database Connection String, ADO.net, MySQL, Oracle, MS SQL Server, MS Access, Password protected databse connection, Using ADO.net with any database
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Ravi Gaurav Pandey ravig.pandey@gmail.

com

Connection Strings in .net

MS Access connection strings


MS Access ODBC connection strings
Standard Security:
"Driver=
{MicrosoftAccessDriver(*.mdb)};DBQ=C:\App1\Your_Database_Name.mdb;Uid=Your_Username;Pwd=Your_Passwo
rd;"

Workgroup:
"Driver={Microsoft Access Driver (*.mdb)}; Dbq=C:\App1\Your_Database_Name.mdb;
SystemDB=C:\App1\Your_Database_Name.mdw;"

Exclusive "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\App1\Your_Database_Name.mdb; Exclusive=1;


Uid=Your_Username; Pwd=Your_Password;"

MS Access OLE DB & OleDbConnection (.NET


framework) connection strings
"Provider=Microsoft.ACE.OLEDB.12.0"

Open connection to Access database:


"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; User Id=admin; Password="

Open connection to Access database using Workgroup (System database):


"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; Jet OLEDB:System
Database=c:\App1\Your_System_Database_Name.mdw"

Open connection to password protected Access database:


"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb; Jet OLEDB:Database
Password=Your_Password"

Open connection to Access database located on a network share:


"Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=\\Server_Name\Share_Name\Share_Path\Your_Database_Name.mdb"

Open connection to Access database located on a remote server:


"Provider=MS Remote; Remote Server=http://Your-Remote-Server-IP; Remote Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=c:\App1\Your_Database_Name.mdb"
Ravi Gaurav Pandey [email protected]

SQL Server connection strings


SQL ODBC connection strings
Standard Security:< br>
"Driver={SQLServer};Server=Your_Server_Name;Database=Your_Database_Name;Uid=Your_Username;Pwd=Your
_Password;"

Trusted connection:< br>


"Driver={SQLServer};Server=Your_Server_Name;Database=Your_Database_Name;Trusted_Connection=yes;"

SQL OLE DB connection strings


Standard Security:
"Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=
Your_Database_Name;UserId=Your_Username;Password=Your_Password;"

Trusted connection:
"Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;Integrated
Security=SSPI;"

SQL OleDbConnection .NET strings


Standard Security:
"Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=
Your_Database_Name;UserId=Your_Username;Password=Your_Password;"

Trusted connection:
"Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;Integrated
Security=SSPI;"

SQL SqlConnection .NET strings


Standard Security:
1. "Data Source=Your_Server_Name;Initial Catalog=
Your_Database_Name;UserId=Your_Username;Password=Your_Password;" < br>2.
"Server=Your_Server_Name;Database=Your_Database_Name;UserID=Your_Username;Password=Your_Password;
Trusted_Connection=False"

Trusted connection:
1. "Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;Integrated Security=SSPI;"
2."Server=Your_Server_Name;Database=Your_Database_Name;Trusted_Connection=True;"
Ravi Gaurav Pandey [email protected]

MySQL connection strings


MySQL ODBC connection strings
Open connection to local MySQL database using MySQL ODBC 3.51 Driver
"Provider=MSDASQL; DRIVER={MySQL ODBC 3.51Driver}; SERVER= localhost;
DATABASE=Your_MySQL_Database; UID= Your_Username; PASSWORD=Your_Password; OPTION=3"

MySQL OLE DB & OleDbConnection (.NET framework)


connection strings
Open connection to MySQL database:
"Provider=MySQLProv;Data Source=Your_MySQL_Database;User Id=Your_Username; Password=Your_Password;"
Ravi Gaurav Pandey [email protected]

Oracle connection strings


Oracle ODBC connection strings
Open connection to Oracle database using ODBC
"Driver= {Microsoft ODBCforOracle};Server=Your_Oracle_Server.world;Uid=Your_Username;Pwd=Your_Password;"

Oracle OLE DB & OleDbConnection (.NET framework)


connection strings
Open connection to Oracle database with standard security:
1. "Provider=MSDAORA;Data Source=
Your_Oracle_Database;UserId=Your_Username;Password=Your_Password;"
2. "Provider= OraOLEDB.Oracle;Your_Oracle_Database;UserId=Your_Username;Password=Your_Password;"

Open trusted connection to Oracle database


"Provider= OraOLEDB.Oracle;DataSource=Your_Oracle_Database;OSAuthent=1;"

You might also like