Connection strings
Tip
connectionstrings.com is a handy repository of example connection strings.
Below are examples of typical connection strings for different data providers and databases.
ODBC provider¶
| Database | Example ODBC Connection String |
|---|---|
| SQL Server 2000/2005/2008 2008R2/2012 | Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd Driver={SQL Server};Server=Aron1;Database=pubs;Trusted\\_Connection=yes |
| Oracle (Oracle Client must be installed) | Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd |
| MySQL | DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3 |
| FastPath | DSN=DSN\\_Name;UID=Username;PWD=password; |
| PostgreSQL | Driver={PostgreSQL Unicode};database=Holidays;server=localhost;port=5432;uid=holidays;pwd=password |
| MS Access (MDB) | Driver={Microsoft Access Driver (\\*.mdb)};Dbq=C:\\mydatabase.mdb;Uid=Admin;Pwd= |
| dBase (DBF) | Driver={Microsoft dBASE Driver (\\*.dbf)};DriverID=277;Dbq=c:\\mydbpath |
| FoxPro | Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\\myvfpdbfolder;Exclusive=No;Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO |
OleDB provider¶
| Database | Example OleDB Connection String |
|---|---|
| SQL Server 2000/2005/2008 2008R2/2012 | Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI |
| Oracle (Oracle Client must be installed) | Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd |
| MySQL | Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd |
| MS Access (MDB) | Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\somepath\\mydb.mdb;User Id=admin;Password= |
| dBase (DBF) | Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\folder;Extended Properties=dBASE IV;User ID=Admin;Password= |
| FoxPro | Provider=vfpoledb.1;Data Source=C:\\MyDataDirectory\\;Collating Sequence=general |
SQL Server provider¶
Standard security¶
Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;
Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted\_Connection=False
Trusted connection¶
Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;
Server=Aron1;Database=pubs;Trusted\_Connection=True;
Oracle provider (Oracle client must be installed)¶
Standard¶
Data Source=MyOracleDB;Integrated Security=yes;
Specifying username and password¶
Data Source=MyOracleDB;User Id=username;Password=passwd;Integrated Security=no;
MySQL provider¶
Note
Only available if the MySQL provider has been installed.
Server=Server;Port=1234;Database=Test;Uid=UserName;Pwd=asdasd;
PostgreSQL provider¶
Note
Only available if the PostgreSQL provider has been installed.
Server=Server;Port=5432;Database=Test;Userid=UserName;Password=asdasd;
Intersystems Caché provider¶
Note
Only available if the Caché provider has been installed.
Server=Server;Port=1972;Namespace=Samples;Password=SYS;User ID=\_SYSTEM;
Snowflake provider¶
Note
Only available if the Snowflake provider has been installed.
"account=qo25880;user=Username;asdasd=1Digit8Chars;host=qo25880.eu-west-1.snowflakecomputing.com;db=SNOWFLAKE_SAMPLE_DATA;schema=TPCH_SF1"