Академический Документы
Профессиональный Документы
Культура Документы
1. SQL Server
ODBC
Standard Security:
"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
Trusted connection:
"Driver={SQL Server};Server=Aron1;Database=pubs;
Trusted_Connection=yes;"
Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User
Id=sa;Password=asdasd;"
Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated
Security=SSPI;"
(use serverName\instanceName as Data Source to use an specifik SQLServer
instance, only SQLServer2000)
SqlConnection (.NET)
Standard Security:
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" - or
-
"Server=Aron1;Database=pubs;User
ID=sa;Password=asdasd;Trusted_Connection=False"
(both connection strings produces the same result)
Trusted Connection:
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" - or
-"Server=Aron1;Database=pubs;Trusted_Connection=True;"
VB.NET:
Imports System.Data.SqlClientDim oSQLConn As SqlConnection = New
SqlConnection()oSQLConn.ConnectionString="my connection
string"oSQLConn.Open()
Data Shape
MS Data Shape"Provider=MSDataShape;Data Provider=SQLOLEDB;Data
Source=Aron1;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
Trusted connection:
"Driver={SQL Native
Client};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
Trusted_Connection=yes;MARS_Connection=yes"
Trusted_Connection=yes;Encrypt=yes"
Attach a database file on connect to a local SQL Server Express instance:
AttachDbFilename=c:\asd\qwe\mydbfile.mdf;
Database=dbname;Trusted_Connection=Yes;"
- or -
AttachDbFilename=DataDirectorymydbfile.mdf;
Database=dbname;Trusted_Connection=Yes;"
(use DataDirectory when your database file resides in the data directory)
(the package contains booth the ODBC driver and the OLE DB provider)
Using SQL Server 2005 Express? Don't miss the server name syntax:
SERVERNAME\SQLEXPRESS (Substitute "SERVERNAME" with the name of the
computer)
Equivalents
(use DataDirectory when your database file resides in the data directory)
Why is the "Database" parameter needed?
Answer: If the database was previously attached,
SQL Server does not reattach it
(it uses the attached database as the default for the connection).
(the package contains booth the ODBC driver and the OLE DB provider)
Using SQL Server 2005 Express? Don't miss the server name syntax:
SERVERNAME\SQLEXPRESS (Substitute "SERVERNAME" with the name of the
computer)
SqlConnection (.NET)
Standard Security:
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User
ID=sa;Password=asdasd;Trusted_Connection=False"
Trusted Connection:
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(use DataDirectory when your database file resides in the data directory)
Why is the "Database" parameter needed?
Answer: If the database was previously attached,
SQL Server does not reattach it (
it uses the attached database as the default for the connection).
Visual Basic:
Using connection as new SqlConnection("context connection=true")
connection.Open() ' Use the connection
End Using
3. Access
ODBC
Standard Security:
"Driver={Microsoft Access Driver (*.mdb)};
Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"
Workgroup:
"Driver={Microsoft Access Driver (*.mdb)};
Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatabase.mdw;"
Exclusive:
"Driver={Microsoft Access Driver (*.mdb)};
Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=admin;Pwd="
With password:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet
OLEDB:Database Password=MyDbPassword;"
4. Oracle
ODBC
New version:
"Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;
Uid=Username;Pwd=asdasd;"
Old version:
"Driver={Microsoft ODBC Driver for Oracle};
ConnectString=OracleServer.world;
Uid=myUsername;Pwd=myPassword;"
Standard Security:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User
Id=Username;Password=asdasd;"
Trusted Connection:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
OracleConnection (.NET)
Standard:
"Data Source=MyOracleDB;Integrated Security=yes;"
VB.NET:
Imports System.Data.OracleClient
Dim oOracleConn As OracleConnection = New OracleConnection()
OracleConn.ConnectionString = "my connection string"
oOracleConn.Open()
Data Shape
MS Data Shape:
"Provider=MSDataShape.1;Persist Security Info=False;Data
Provider=MSDAORA;Data Source=orac;user id=username;password=mypw"
5. MySQL
MyODBC
MyODBC 2.50 Local database:
"Driver={mySQL};Server=localhost;
Option=16834;Database=mydatabase;"
Standard:
"Server=Server;Database=Test;Uid=UserName;Pwd=asdasd;"
Specifying port:
"Server=Server;Port=1234;Database=Test;
Uid=UserName;Pwd=asdasd;"
VB.NET:
Imports MySql.Data.MySqlClient
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString =
"Server=Server;Database=Test;Uid=UserName;Pwd=asdasd;"
oMySqlConn.Open()
MySqlConnection (.NET)
eInfoDesigns.dbProvider:
"Data Source=server;Database=mydb;User
ID=username;Password=pwd;Command Logging=false"
VB.NET:
Imports eInfoDesigns.dbProvider.MySqlClient
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "my connection string"
oMySqlConn.Open()
6.Interbase
ODBC, Easysoft
Local computer:
"Driver={Easysoft IB6 ODBC};
Server=localhost;Database=localhost:C:\mydatabase.gdb;
Uid=username;Pwd=password"
Remote Computer:
"Driver={Easysoft IB6 ODBC};
Server=ComputerName;
Database=ComputerName:C:\mydatabase.gdb;
Uid=username;Pwd=password"
ODBC, Intersolv
Local computer:
"Driver={INTERSOLV InterBase ODBC Driver
(*.gdb)};Server=localhost;Database=localhost:C:\mydatabase.gdb;
Uid=username;Pwd=password"
Remote Computer:
"Driver={INTERSOLV InterBase ODBC Driver (*.gdb)};
Server=ComputerName;
Database=ComputerName:C:\mydatabase.gdb;
Uid=username;Pwd=password"
Specifying role:
"provider=sibprovider;location=localhost:;data
source=c:\databases\gdbs\mygdb.gdb;user
id=SYSDBA;password=masterkey;role=DIGITADORES"
7.IBM DB2
APPC:
"Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU
Alias=MyRemote;Initial Catalog=MyCtlg;Package
Collection=MyPkgCol;Default Schema=Schema;
User ID=MyUser;Password=MyPW"
8.Sybase
ODBC
Standard Sybase System 12 Enterprise Open Client:
"Driver={SYBASE ASE ODBC
Driver};Srvr=Aron1;Uid=username;Pwd=password"
For more information check out the Adaptive Server Enterprise Document
Sets
Intersolv 3.10:
"Driver={INTERSOLV 3.10 32-BIT
Sybase};Srvr=Aron1;Uid=username;Pwd=password;"
Note! The two double quota ("") following the DSN parameter at
the end are escaped quotas (VB syntax),
you may have to change this to your
language specific escape syntax (\") or maybe single quota (').
The empty DSN parameter is indeed critical as not including it will result in
error 7778.
OLE DB
Adaptive Server Anywhere (ASA):
"Provider=ASAProv;Data source=myASA"
Read more in the ASA User Guide (part 1, chapter 2) >>
Note that you must create a Data Source .IDS file using
the Sybase Data Advministrator. These .IDS files resemble ODBC DSNs.
- some reports on problem using the above one, try the following as an
alternative -
"Provider=Sybase.ASEOLEDBProvider;
Server Name=myASEserver,5000;Initial Catalog=myDBname;
User Id=username;Password=password"
This one works only from Open Client 12.5 where the server port number
feature works,
allowing fully qualified connection strings to be used without
defining any .IDS Data Source files.
AseConnection (.NET)
Standard:
"Data Source='myASEserver';Port=5000;Database='myDBname';
UID='username';PWD='password';"
VB.NET:
Imports System.Data.AseClientDim oCon As AseConnection = New
AseConnection()oCon.ConnectionString="my connection string"oCon.Open()
9.Informix
ODBC
Informix 3.30:
"Dsn='';Driver={INFORMIX 3.30 32 BIT};Host=hostname;
Server=myserver;Service=service-name;Protocol=olsoctcp;
Database=mydb;UID=username;PWD=myPwd
Informix-CLI 2.5:
"Driver={Informix-CLI 2.5 (32 Bit)};Server=myserver;
Database=mydb;Uid=username;Pwd=myPwd"
OLE DB
IBM Informix OLE DB Provider:
"Provider=Ifxoledbc.2;password=myPw;User
ID=myUser;DataSource=dbName@serverName;
Persist Security Info=true"
10. Ingres
ODBC
DSN-less:
"Provider=MSDASQL.1;DRIVER=Ingres;SRVR=xxxxx;
DB=xxxxx;Persist Security Info=False;uid=xxxx;
pwd=xxxxx;SELECTLOOPS=N;
Extended Properties=""SERVER=xxxxx;
DATABASE=xxxxx;SERVERTYPE=INGRES"""
Important note! The two double quota ("") in the string are
escaped quotas (VB syntax), you may have to change this to your
language specific escape syntax (ex. \") or maybe single quota (').
ODBC
Standard Security:
"Driver={MIMER};Database=mydb;Uid=myuser;Pwd=mypw;"
12. Lightbase
Standard
Standard:
"user=USERLOGIN;password=PASSWORD;UDB=USERBASE;
server=SERVERNAME"
13.PostgreSQL
Core Labs PostgreSQLDirect (.NET)
Standard:
"User ID=root; Password=pwd; Host=localhost; Port=5432;
Database=testdb;Pooling=true;
Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0"
PostgreSQL driver
Standard:
"DRIVER={PostgreSQL};SERVER=ipaddress;port=5432;
DATABASE=dbname;UID=username;PWD=password;"
Without SSL:
"Server=127.0.0.1;Port=5432;Userid=myuserid;
password=mypw;
Protocol=3;SSL=false;
Pooling=true;MinPoolSize=1;MaxPoolSize=20;
Encoding=UNICODE;Timeout=15;SslMode=Disable"
14. Paradox
ODBC
5.X:
Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox
5.X;DefaultDir=c:\pathToDb\;Dbq=c:\pathToDb\;
CollatingSequence=ASCII"
7.X:
"Provider=MSDASQL.1;Persist Security Info=False;Mode=Read;Extended
Properties='DSN=Paradox;DBQ=C:\myDb;
DefaultDir=C:\myDb;DriverId=538;FIL=Paradox 7.X;
MaxBufferSize=2048;PageTimeout=600;';Initial Catalog=C:\myDb"
OleDbConnection (.NET)
Standard
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\myDb;
Extended Properties=Paradox 5.x;"
15. DSN
ODBC
DSN:
"DSN=myDsn;Uid=username;Pwd=;"
File DSN:
"FILEDSN=c:\myData.dsn;Uid=username;Pwd=;"
16. Firebird
17. Excel
ODBC
Standard:
"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;
Dbq=C:\MyExcel.xls;DefaultDir=c:\mypath;"
TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed
by a "$"
and wrapped in "[" "]" brackets.
OLE DB
Standard:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended
Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
"HDR=Yes;" indicates that the first row contains columnnames, not data
Important note! The two double quota ("") in the string are escaped quotas
(VB syntax),
you may have to change this to your language specific escape syntax (ex. \")
or
maybe single quota (').
18. Text
ODBC
Standard:
"Driver={Microsoft Text Driver (*.txt; *.csv)};
Dbq=c:\txtFilesFolder\;Extensions=asc,csv,tab,txt;"
OLE DB
Standard:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;Extended
Properties=""text;HDR=Yes;FMT=Delimited"""
"HDR=Yes;" indicates that the first row contains columnnames, not data
Important note! The two double quota ("") in the string are escaped quotas
(VB syntax),
you may have to change this to your language specific escape syntax (ex. \")
or maybe single quota (').
ODBC
IBM Client Access ODBC driver:
"Driver={Client Access ODBC Driver (32-bit)};System=my_system_name;
Uid=myUserName;Pwd=myPwd"
21. Exchange
OLE DB
Exchange OLE DB provider:
"ExOLEDB.DataSource"
ODBC
Database container (.DBC):
"Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;
SourceDB=c:\myvfpdb.dbc;Exclusive=No;
NULL=NO;
Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"
23 Pervasive
ODBC
Standard:
"Driver={Pervasive ODBC Client
Interface};ServerName=srvname;dbq=@dbname"
Pervasive ODBC info >>
OLE DB
Standard:
"Provider=PervasiveOLEDB;Data Source=C:\path"
24. UDL
UDL
UDL:
"File Name=c:\myDataLink.udl;"