Sunday, January 8, 2012

#5: Connection Strings

Happy new year readers!

Connection Strings. This is my first blog of this year 2012 and I know most of you are familiar with it. But I just wanna share these list of connection strings so that you don't have to go anywhere when you need it.

MS SQL 2008/2005
.NET Framework Data Provider for SQL Server
usage: System.Data.SqlClient.SqlConnection

Server=YourServerName;Database=YourDataBase;User ID=YourUsername;Password=YourPassword;Trusted_Connection=False;

MySQL
MySQL Connector/Net
usage:  MySql.Data.MySqlClient.MySqlConnection

Server=YourServerName;Database=YourDataBase;Uid=YourUsername;Pwd=YourPassword;

Oracle
Oracle Data Provider for .NET / ODP.NET
USAGE Oracle.DataAccess.Client.OracleConnection

Data Source=TORCL;User Id=YourUsername;Password=YourPassword;

SQL Azure
.NET Framework Data Provider for SQL Server
USAGE System.Data.SqlClient.SqlConnection

Server=tcp:[serverName].database.windows.net;Database=YourDataBase;User ID=[LoginForDb]@[serverName];Password=YourPassword;Trusted_Connection=False;Encrypt=True;

Access 2007
ACE OLEDB 12.0
USAGE Provider=Microsoft.ACE.OLEDB.12.0

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\YourAccess2007yourdata.accdb;Jet OLEDB:Database Password=YourDbPassword;

Access 2000/2003
Microsoft Jet OLE DB 4.0
USAGE Provider=Microsoft.Jet.OLEDB.4.0

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\yourdatabase.mdb;Jet OLEDB:Database Password=YourDbPassword;

SQL Lite
SQLite.NET
USAGE System.Data.SQLite.SQLiteConnection

Data Source=YourDBFilename;Version=3;Password=YourPassword;

These are the most common connection strings that I've been using. Different database have different connection strings. If you have some questions, please hit the comments. 

You'll learn more on my next blog. 

Thank you! 

No comments:

Post a Comment