Elenco di alcune connection string usate in .NET
Sostituire gli elementi compresi tra i simboli < e > con gli appropriati parametri

SQL Server 2000 - SqlConnection

Data Source=<ServerName>;Initial Catalog=<DatabaseName>;User Id=<Username>;Password=<Password>;
Server=<ServerName>;Database=<DatabaseName>;User ID=<Username>;Password=<Password>;Trusted_Connection=False

o nel caso di trusted connection

Data Source=<ServerName>;Initial Catalog=<DatabaseName>;Integrated Security=SSPI;
Server=<ServerName>;Database=<DatabaseName>;Trusted_Connection=True; 

SQL Server 2000 - OLE DB e OleDbConnection

Provider=SQLOLEDB;Data Source=<ServerName>;Initial Catalog=<DatabaseName>;User Id=<Username>;Password=<Password>;

o nel caso di trusted connection

Provider=SQLOLEDB;Data Source=<ServerName>;Initial Catalog=<DatabaseName>;Integrated Security=SSPI;

SQL Server 2000 - ODBC

Driver={SQLServer};Server=<ServerName>;Database=<DatabaseName>;Uid=<Username>;Pwd=<Password>;

o nel caso di trusted connection

Driver={SQLServer};Server=<ServerName>;Database=<DatabaseName>;Trusted_Connection=yes;

Access

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<\dir\dbAccess.mdb>;User Id=<admin>;Password=;

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<\dir\dbAccess.mdb>;Jet OLEDB:Database Password=<Password>;

Access 2007

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<\dir\dbAccess.mdb>;Persist Security Info=false

MySQL - OLE DB, OleDbConnection

Provider=MySQLProv;Data Source=<DatabaseName>;User Id=<Username>;Password=<Password>;

MySQL

DRIVER={MySQL ODBC 3.51 Driver};SERVER=<localhost>;DATABASE=<DatabaseName>;USER=<Username>;PASSWORD=<Password>;OPTION=3;

DRIVER={MySQL ODBC 3.51 Driver};SERVER=<host.domain.com>;PORT=<3306>;DATABASE=<DatabaseName>;USER=<Username>;PASSWORD=<Password>;OPTION=3;
o
Driver={mySQL};Server=<localhost>;Option=16834;Database=<DatabaseName>;

Excel - OLE DB

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<\dir\dbExcel.xls>;Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;
- HDR=Yes; indica che la prima riga contiene i nomei delle colonne e noni dati
- IMEX=1; forza il driver a leggere le colonne "intermixed" sempre come testo
Un esempio di query SQL è: SELECT * FROM [sheet1$]

AS/400 - OLE DB, OleDbConnection

PROVIDER=IBMDA400;DATA SOURCE=<AS400Name>;USER ID=<Username>;PASSWORD=<Password>

PROVIDER=IBMDA400;DATA SOURCE=<AS400Name>;USER ID=<Username>;PASSWORD=<Password>;DEFAULT COLLECTION=<Library>;
Valido per il Client Access IBM

AS/400 - ODBC

Driver={Client Access ODBC Driver (32-bit)};System=<AS400Name>;Uid=<Username>;Pwd=<Password>;
Valido per il Client Access IBM

ORACLE - OLE DB, OleDbConnection

Provider=msdaora;Data Source=<OracleDB>;User Id=<Username>;Password=<Password>;

Provider=OraOLEDB.Oracle;Data Source=<OracleDB>;User Id=<Username>;Password=<Password>;

o nel caso di trusted connection

Provider=OraOLEDB.Oracle;Data Source=<OracleDB>;OSAuthent=1;


Per maggiori info sulle connection string http://www.connectionstrings.com/
Tags:
Database75 Excel11 Oracle24 SQL90
Potrebbe interessarti anche: