数据库连接串大全

数据库连接串大全

第一部分:DataBase servers

 

一、SQL Server

This is a compiled connection strings reference list on how to connect to SQL Server.

Looking for SQL Server 2005 connection strings? They are here »
Looking for SQL Server 2005 CE connection strings? They are here »

ODBC

 

Standard Security

 

 

Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Trusted connection

 

 

Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=Yes;

 

 COPY TO CLIPBOARD

Prompt for username and password

This one is a bit tricky. First you need to set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

 

oConn.Properties("Prompt") = adPromptAlways

Driver={SQL Server};Server=myServerAddress;Database=myDataBase;

 

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

Standard Security

 

 

Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Trusted connection

 

 

Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

Use serverName/instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.

 COPY TO CLIPBOARD

Prompt for username and password

This one is a bit tricky. First set the connection object's Provider property to "sqloledb". Thereafter set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

 

oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways

Data Source=myServerAddress;Initial Catalog=myDataBase;

 

 COPY TO CLIPBOARD

Connect via an IP address

 

 

Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

How to define which network protocol to use >>

 COPY TO CLIPBOARD

SqlConnection (.NET)

 

Standard Security

 

 

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Standard Security alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

 

Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;

 

 COPY TO CLIPBOARD

Trusted Connection

 

 

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

 

 COPY TO CLIPBOARD

Trusted Connection alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

 

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

Use serverName/instanceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.

 COPY TO CLIPBOARD

Trusted Connection from a CE device

Often a Windows CE device is not authenticated and logged in to a domain. To use SSPI or trusted connection / authentication from a CE device, use this connection string.

 

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain/myUsername;Password=myPassword;

Note that this will only work on a CE device.

Read more about connecting to SQL Server from CE devices here >>

 COPY TO CLIPBOARD

Connect via an IP address

 

 

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

How to define which network protocol to use >>

 COPY TO CLIPBOARD

Specifying packet size

 

 

Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;Packet Size=4096;

By default, the Microsoft .NET Framework Data Provider for SQL Server sets the network packet size to 8192 bytes. This might however not be optimal, try to set this value to 4096 instead.

The default value of 8192 might cause errors as well ("Failed to reserve contiguous memory"), check this out >>

 COPY TO CLIPBOARD

Data Shape

 

MS Data Shape

 

 

Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

二、Sybase

 

This is a compiled connection strings reference list on how to connect to Sybase.

 

ODBC

 

Adaptive Server Enterprise 15.0

 

 

Driver=={Adaptive Server Enterprise};app=myAppName;server=myServerAddress;port=myPortnumber;db=myDataBase;uid=myUsername;pwd=myPassword;

The key "app" is optional

 COPY TO CLIPBOARD

Standard Sybase System 12 Enterprise Open Client

 

 

Driver={SYBASE ASE ODBC Driver};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Standard Sybase System 12.5 Enterprise Open Client

 

 

Driver={SYBASE ASE ODBC Driver};NA=Hostname,Portnumber;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

TDS based ODBC driver (from Sybase OCS 12.5)

 

 

Driver={Sybase ASE ODBC Driver};NetworkAddress=myServerAddress,5000;Db=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Standard Sybase System 11

 

 

Driver={SYBASE SYSTEM 11};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;Database=myDataBase;

Check out the Adaptive Server Enterprise Document Sets >>

 COPY TO CLIPBOARD

Intersolv 3.60

 

 

Driver={INTERSOLV 3.60 32-BIT Sybase};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;Database=myDataBase;

 

 COPY TO CLIPBOARD

Intersolv 3.10

 

 

Driver={INTERSOLV 3.10 32-BIT Sybase};Srvr=myServerAddress;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Sybase SQL Anywhere (former Watcom SQL ODBC driver)

 

 

ODBC;Driver=Sybase SQL Anywhere 5.0;DefaultDir=c:/dbfolder/;Dbf=c:/mydatabase.db;Uid=myUsername;Pwd=myPassword;Dsn="";

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   /"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

The empty DSN parameter is indeed critical as not including it will result in error 7778.

Read more in the Sybase SQL Anywhere User Guide (see part 3, chapter 13) >>

 COPY TO CLIPBOARD

OLE DB

 

Adaptive Server Anywhere (ASA)

 

 

Provider=ASAProv;Data source=myASA;

Read more in the ASA User Guide (part 1, chapter 2) >>

 COPY TO CLIPBOARD

Adaptive Server Anywhere (ASA)

 

 

Provider=ASAProv.90;Eng=server.database_name;Uid=myUsername;Pwd=myPassword;Links=tcpip(Host=servername);

Use this when connecting to a server located on the other side of a router. Without the Links=tcpip(Host=servername) the error "Server could not be found" can arise when connecting.

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) with Data Source .IDS file

 

 

Provider=Sybase ASE OLE DB Provider;Data source=myASE;

Note that you must create a Data Source .IDS file using the Sybase Data Administrator. These .IDS files resemble ODBC DSNs.

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) alternative 1

 

 

Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Some reports on problem using the above one, try the following as an alternative.

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) alternative 2

 

 

Provider=Sybase.ASEOLEDBProvider;Server Name=myASEserver,5000;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Some other reports on problem using the above one, try the following as an alternative

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) 12.5

 

 

Provider=Sybase.ASEOLEDBProvider.2;Server Name=myASEserver;Server Port Address=5000;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

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.

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) 15.0

 

 

Provider=ASEOLEDB;Data Source=myASEserver:5000;Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Adaptive Server Enterprise (ASE) 15.0 alternative

This one is included because of reported problems with using the "Catalog" key which was solved by using the 12.5 syntax key "Initial Catalog" instead.

 

Provider=ASEOLEDB;Data Source=myASEserver:5000;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

AseConnection (.NET)

 

Standard

 

 

Data Source='myASEserver';Port=5000;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Read more! Adaptive Server Enterprise ADO.NET Data Document Sets >>

 COPY TO CLIPBOARD

Using the sql.ini file

If the server isn't aliased, you have to use the ip address and port number in the connection string, not ideal as these may change occassionally. Installing sybase on a machine, you will have a "sql.ini" file that maps an alias name to an ip address and a port. That file can be rolled out to all users, and the sql.ini updated when necessary. Use the following connection string to force the AseConnection object to use the interface file.

 

DSURL='file://c:/sybase/ini/sql.ini?SQL_MIDOFF_OPC1';Database=myDataBase; UID=myUsername;PWD=myPassword;APP=myAppName;

三、Firebird

This is a compiled connection strings reference list on how to connect to Firebird.

 

ODBC - IBPhoenix Open Source

 

Standard

 

 

Driver=Firebird/InterBase(r) driver;Uid=SYSDBA;Pwd=masterkey;DbName=D:/FIREBIRD/examples/TEST.FDB;

IBPhoenix ODBC; More info, download etc >>

 COPY TO CLIPBOARD

.NET - Firebird .Net Data Provider

 

Standard

 

 

User=SYSDBA;Password=masterkey;Database=SampleDatabase.fdb;DataSource=localhost;Port=3050;Dialect=3; Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;

四、SQL Server 2005

SQL Server 2005

This is a compiled connection strings reference list on how to connect to SQL Server 2005.

Looking for SQL Server 2005 CE connection strings? They are here »
Looking for SQL Server connection strings? They are here »

SQL Native Client ODBC Driver

 

Standard security

 

 

Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Are you using SQL Server 2005 Express? Don't miss the server name syntax Servername/SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2005 Express installation resides.

 COPY TO CLIPBOARD

Trusted Connection

 

 

Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

Equivalent key-value pair: "Integrated Security=SSPI" equals "Trusted_Connection=yes"

 COPY TO CLIPBOARD

Prompt for username and password

This one is a bit tricky. First you need to set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

 

oConn.Properties("Prompt") = adPromptAlways

Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;

 

 COPY TO CLIPBOARD

Enabling MARS (multiple active result sets)

 

 

Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;MARS_Connection=yes;

Equivalent key-value pair: "MultipleActiveResultSets=true" equals "MARS_Connection=yes"

Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1.

Using MARS with SQL Native Client, by Chris Lee >>

 COPY TO CLIPBOARD

Encrypt data sent over network

 

 

Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;Encrypt=yes;

 

 COPY TO CLIPBOARD

Attach a database file on connect to a local SQL Server Express instance

 

 

Driver={SQL Native Client};Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

 COPY TO CLIPBOARD

Attach a database file, located in the data directory, on connect to a local SQL Server Express instance

 

 

Driver={SQL Native Client};Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

Download the SQL Native Client here. The package contains booth the ODBC driver and the OLE DB provider >>

 COPY TO CLIPBOARD

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

 

Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.

Read more about database mirroring in this Microsoft TechNet article "Database Mirroring in SQL Server 2005" >>

 COPY TO CLIPBOARD

SQL Native Client OLE DB Provider

 

Standard security

 

 

Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Are you using SQL Server 2005 Express? Don't miss the server name syntax Servername/SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2005 Express installation resides.

 COPY TO CLIPBOARD

Trusted connection

 

 

Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

Equivalent key-value pair: "Integrated Security=SSPI" equals "Trusted_Connection=yes"

 COPY TO CLIPBOARD

Prompt for username and password

This one is a bit tricky. First you need to set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

 

oConn.Properties("Prompt") = adPromptAlways

oConn.Open "Provider=SQLNCLI;Server=myServerAddress;DataBase=myDataBase;

 

 COPY TO CLIPBOARD

Enabling MARS (multiple active result sets)

 

 

Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;MarsConn=yes;

Equivalent key-value pair: "MultipleActiveResultSets=true" equals "MARS_Connection=yes"

Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1.

Using MARS with SQL Native Client, by Chris Lee >>

 COPY TO CLIPBOARD

Encrypt data sent over network

 

 

Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;Encrypt=yes;

 

 COPY TO CLIPBOARD

Attach a database file on connect to a local SQL Server Express instance

 

 

Provider=SQLNCLI;Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

 COPY TO CLIPBOARD

Attach a database file, located in the data directory, on connect to a local SQL Server Express instance

 

 

Provider=SQLNCLI;Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

Download the SQL Native Client here. The package contains booth the ODBC driver and the OLE DB provider >>

 COPY TO CLIPBOARD

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

 

Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.

Read more about database mirroring in this Microsoft TechNet article "Database Mirroring in SQL Server 2005" >>

 COPY TO CLIPBOARD

SqlConnection (.NET)

 

Standard Security

 

 

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Use serverName/instanceName as Data Source to connect to a specific SQL Server instance.

Are you using SQL Server 2005 Express? Don't miss the server name syntax Servername/SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2005 Express installation resides.

 COPY TO CLIPBOARD

Standard Security alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

 

Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;

 

 COPY TO CLIPBOARD

Trusted Connection

 

 

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

 

 COPY TO CLIPBOARD

Trusted Connection alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

 

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

 

 COPY TO CLIPBOARD

Trusted Connection from a CE device

Often a Windows CE device is not authenticated and logged in to a domain. To use SSPI or trusted connection / authentication from a CE device, use this connection string.

 

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain/myUsername;Password=myPassword;

Note that this will only work on a CE device.

Read more about connecting to SQL Server from CE devices here >>

 COPY TO CLIPBOARD

Connect via an IP address

 

 

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

How to define which network protocol to use >>

 COPY TO CLIPBOARD

Enabling MARS (multiple active result sets)

 

 

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;MultipleActiveResultSets=true;

Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1.

Streamline your Data Connections by Moving to MARS, by Laurence Moroney, DevX.com >>

 COPY TO CLIPBOARD

Attach a database file on connect to a local SQL Server Express instance

 

 

Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

 COPY TO CLIPBOARD

Attach a database file, located in the data directory, on connect to a local SQL Server Express instance

 

 

Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

 COPY TO CLIPBOARD

Using an User Instance on a local SQL Server Express instance

The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer.

 

Data Source=./SQLExpress;Integrated Security=true;AttachDbFilename=|DataDirectory|/mydb.mdf;User Instance=true;

To use the User Instance functionality you need to enable it on the SQL Server. This is done by executing the following command: sp_configure 'user instances enabled', '1'. To disable the functionality execute sp_configure 'user instances enabled', '0'.

 COPY TO CLIPBOARD

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

 

Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.

Read more about database mirroring in this Microsoft TechNet article "Database Mirroring in SQL Server 2005" >>

 COPY TO CLIPBOARD

Asynchronous processing

A connection to SQL Server 2005 that allows for the issuing of async requests through ADO.NET objects.

 

Server=myServerAddress;Database=myDataBase;Integrated Security=True;Asynchronous Processing=True;

 

 COPY TO CLIPBOARD

SQL Server 2005 specials

 

Context Connection

Connecting to "self" from within your CLR stored prodedure/function. The context connection lets you execute Transact-SQL statements in the same context (connection) that your code was invoked in the first place.

 

C#
 using(SqlConnection connection = new SqlConnection("context connection=true"))
 {
     connection.Open();
     // Use the connection
 }

VB.Net
 Using connection as new SqlConnection("context connection=true")
     connection.Open()
     ' Use the connection
 End Using

When to use SQL Native Client? >>

List of all SqlConnection connection string properties >>

 

五、Informix

This is a compiled connection strings reference list on how to connect to Informix.

 

ODBC

 

Informix 3.30

 

 

Dsn='';Driver={INFORMIX 3.30 32 BIT};Host=hostname;Server=myServerAddress;Service=service-name;Protocol=olsoctcp;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Informix-CLI 2.5:

 

 

Driver={Informix-CLI 2.5 (32 Bit)};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

OLE DB

 

IBM Informix OLE DB Provider

 

 

Provider=Ifxoledbc.2;Password=myPassword;User ID=myUsername;Data Source=dbName@serverName;Persist Security Info=true;

 

 COPY TO CLIPBOARD

IBM Informix .NET Provider

 

IBM.Data.Informix.IfxConnection

 

 

Database=myDataBase;Host=192.168.10.10;Server=db_engine_tcp;Service=1492; Protocol=onsoctcp;UID=myUsername;Password=myPassword;

六、AS/400 (iSeries)

This is a compiled connection strings reference list on how to connect to AS/400 (iSeries).

 

IBM .Net Data Provider

 

Using the IBM.Data.DB2.iSeries namespace

 

 

DataSource=myServerAddress;UserID=myUsername;Password=myPassword;DataCompression=True;

 

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

IBM Client Access OLE DB provider

 

 

Provider=IBMDA400;Data Source=MY_SYSTEM_NAME;User Id=myUsername;Password=myPassword;

Where MY_SYSTEM_NAME is the name given to the system connection in OperationsNavigator

 COPY TO CLIPBOARD

IBM Client Access OLE DB provider

 

 

Provider=IBMDA400;Data Source=MY_SYSTEM_NAME;User Id=myUsername;Password=myPassword;Default Collection=MY_LIBRARY;

Where MY_SYSTEM_NAME is the name given to the System Connection, and MY_LIBRARY is the name given to the library in iSeries Navigator.

 COPY TO CLIPBOARD

ODBC

 

IBM Client Access ODBC driver

 

 

Driver={Client Access ODBC Driver (32-bit)};System=my_system_name;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

IBM iSeries Access ODBC driver

This driver is newer than the one above.

 

Driver={iSeries Access ODBC Driver};System=my_system_name;Uid=myUsername;Pwd=myPassword;

七、SQL Server 2005 Compact Edition

This is a compiled connection strings reference list on how to connect to SQL Server 2005 Compact Edition.

Looking for SQL Server connection strings? They are here »
Looking for SQL Server 2005 connection strings? They are here »

OLE DB, OleDbConnection (.NET)

 

Standard

 

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;

 

 COPY TO CLIPBOARD

How to specify the location of the SDF file

Often times the .SDF database is not running in the current directory so it becomes necessary to programatically set the path to the SDF file. This is an example (.net C#) on how to do this when the SDF file is located in the same directory as the executing application.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "//MyData.sdf;

 

 COPY TO CLIPBOARD

Specifying the maximum database size

The maximum size of the database is by default 128 MB. Override this by using the following connection string.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Max Database Size=256;

 

 COPY TO CLIPBOARD

Specifying the maximum buffer size

The largest amount of memory that can be in use before the server starts flushing changes to disk is by default 640 kB. Override this by using the following connection string.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Max Buffer Size=1024;

 

 COPY TO CLIPBOARD

Encryption enabled

Use this connection string to enable encryption on the database.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Encrypt Database=True;

 

 COPY TO CLIPBOARD

Specifying the maximum temp file size

The maximum size of the temporary database file is by default 128 MB. Override this by using the following connection string.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Temp File Max Size=256;

 

 COPY TO CLIPBOARD

Specifying location of temp file

Set the directory for the temp file location using this connection string.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Temp File Directory="/myTempDir/";

 

 COPY TO CLIPBOARD

Supplying the database password

Use this connection string to provide the database password when opening the connection.

 

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath/myData.sdf;SSCE:Database Password='myPassword';

 

 COPY TO CLIPBOARD

SqlCeConnection (.NET)

 

Standard

 

 

Data Source=MyData.sdf;Persist Security Info=False;

 

 COPY TO CLIPBOARD

How to specify the location of the SDF file

Often times the .SDF database is not running in the current directory so it becomes necessary to programatically set the path to the SDF file. This is an example (.net C#) on how to do this when the SDF file is located in the same directory as the executing application.

 

Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "//MyData.sdf;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Standard

 

 

Data Source=MyData.sdf;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Specifying the maximum database size

The maximum size of the database is by default 128 MB. Override this by using the following connection string.

 

Data Source=MyData.sdf;Max Database Size=256;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Specifying the maximum buffer size

The largest amount of memory that can be in use before the server starts flushing changes to disk is by default 640 kB. Override this by using the following connection string.

 

Data Source=MyData.sdf;Max Buffer Size=1024;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Encryption enabled

Use this connection string to enable encryption on the database.

 

Data Source=MyData.sdf;Encrypt Database=True;Password=myPassword;File Mode=shared read;Persist Security Info=False;

The Encrypt Database="True" pair is really not necessary as the presence of the Password-parameter itself turns on encryption for the connection.

 COPY TO CLIPBOARD

Exclusive access

Use this one to disallow other processes from opening or modifying the database while you have it open.

 

Data Source=MyData.sdf;File Mode=Exclusive;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Read only access

Use this one to open a read-only copy of the database.

 

Data Source=MyData.sdf;File Mode=Read Only;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Exclusive but shared for reading

Use this one to allow other processes to read, but not modify, the database while you have it open.

 

Data Source=MyData.sdf;File Mode=Shared Read;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Specifying the maximum temp file size

The maximum size of the temporary database file is by default 128 MB. Override this by using the following connection string.

 

Data Source=MyData.sdf;Temp File Max Size=256;Persist Security Info=False;

八、Ingres

This is a compiled connection strings reference list on how to connect to Ingres.

 

ODBC

 

DSN-less

 

 

Provider=MSDASQL.1;DRIVER=Ingres;SRVR=xxxxx;DB=xxxxx;Persist Security Info=False;Uid=myUsername;Pwd=myPassword;SELECTLOOPS=N;Extended Properties="SERVER=xxxxx;DATABASE=xxxxx;SERVERTYPE=INGRES";

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   /"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

 COPY TO CLIPBOARD

 

九、Pervasive

This is a compiled connection strings reference list on how to connect to Pervasive.

 

ODBC

 

Standard

 

 

Driver={Pervasive ODBC Client Interface};ServerName=myServerAddress;dbq=@dbname;

Pervasive ODBC info >> >>

 COPY TO CLIPBOARD

OLE DB

 

Standard

 

 

Provider=PervasiveOLEDB;Data Source=C:/path;

十、Oracle

This is a compiled connection strings reference list on how to connect to Oracle.

 

ODBC

 

New version

 

 

Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Old version

 

 

Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

Standard security

This connection string uses a provider from Microsoft.

 

Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Trusted connection

 

 

Provider=msdaora;Data Source=MyOracleDB;Persist Security Info=False;Integrated Security=Yes;

 

 COPY TO CLIPBOARD

Standard Security

This connection string uses a provider from Oracle.

 

Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Trusted Connection

 

 

Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;

 

 COPY TO CLIPBOARD

OracleConnection, Oracle Data Provider, ODP.NET

 

Standard

 

 

Data Source=MyOracleDB;Integrated Security=yes;

This one works only with Oracle 8i release 3 or later

 COPY TO CLIPBOARD

Specifying username and password

 

 

Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;

This one works only with Oracle 8i release 3 or later

Missing the System.Data.OracleClient namespace? Download .NET Managed Provider for Oracle >>

Great article! "Features of Oracle Data Provider for .NET" by Rama Mohan G. at C# Corner >>

 COPY TO CLIPBOARD

Omiting tnsnames.ora

This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc.

 

SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;

 

 COPY TO CLIPBOARD

Using Connection Pooling

The connection pooling service will create a new pool if it can't find any existing pool that exactly match the new connections connection string properties. If there is a matching pool a connection will be recycled from that pool.

 

Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2;

 

 COPY TO CLIPBOARD

Windows Authentication

 

 

Data Source=myOracleDB;User Id=/;

 

 COPY TO CLIPBOARD

Privileged Connection

With SYSDBA privileges

 

Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSDBA;

 

 COPY TO CLIPBOARD

Privileged Connection

With SYSOPER privileges

 

Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSOPER;

 

 COPY TO CLIPBOARD

Utilizing the Password Expiration functionality

First open a connection with a connection string. When the connection is opened, an error is raised because the password have expired. Catch the error and execute the OpenWithNewPassword command supplying the new password.

 

Data Source=myOracleDB;User Id=myUsername;Password=myPassword;

oConn.OpenWithNewPassword(sTheNewPassword);

 

 COPY TO CLIPBOARD

Proxy Authentication

 

 

Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Proxy User Id=pUserId;Proxy Password=pPassword;

 

 COPY TO CLIPBOARD

Core Labs OraDirect (.NET)

 

Standard

 

 

User ID=myUsername;Password=myPassword;Host=ora;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;

Read more at Core Lab >>

And at the product page >>

 COPY TO CLIPBOARD

Data Shape

 

MS Data Shape

 

 

Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;User Id=myUsername;Password=myPassword;

 

十一、       Mimer SQL

This is a compiled connection strings reference list on how to connect to Mimer SQL.

 

ODBC

 

Standard Security

 

 

Driver={MIMER};Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Prompt for username and password

 

 

Driver={MIMER};Database=myDataBase;

十二、SQLBase

This is a compiled connection strings reference list on how to connect to SQLBase.

 

OLE DB

 

Standard

 

 

Provider=SQLBaseOLEDB;Data source=myServerAddress;Location=myDataBase;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

SQLBase .NET Data Provider

 

Standard SQLBaseConnection

 

 

DataSource=myServerAddress;UserId=myUsername;Password=myPassword;Poolsize=5;Connection Lifetime=60;

 

十三、MySQL

This is a compiled connection strings reference list on how to connect to MySQL.

 

MyODBC

 

MyODBC 2.50 Local database

 

 

Driver={mySQL};Server=localhost;Option=16834;Database=myDataBase;

 

 COPY TO CLIPBOARD

MyODBC 2.50 Remote database

 

 

Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=; Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

MyODBC 3.51 Local database

 

 

Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;

 

 COPY TO CLIPBOARD

MyODBC 3.51 Remote database

 

 

Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;

 

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

Standard

 

 

Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

Connector/Net 1.0 (.NET)

 

Standard

 

 

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Default port is 3306.

 COPY TO CLIPBOARD

Specifying port

 

 

Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Download the driver at MySQL Developer Zone >>

 COPY TO CLIPBOARD

Named pipes

 

 

Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

It is the port value of -1 that tells the driver to use named pipes network protocol.

 COPY TO CLIPBOARD

MySqlConnection (.NET)

 

eInfoDesigns.dbProvider

 

 

Data Source=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Command Logging=false;

This one is used with eInfoDesigns dbProvider, an add-on to .NET >>

 COPY TO CLIPBOARD

SevenObjects MySqlClient (.NET)

 

Standard

 

 

Host=myServerAddress;UserName=myUsername;Password=myPassword;Database=myDataBase;

This is a freeware ADO.Net data provider from SevenObjects >>

 COPY TO CLIPBOARD

Core Labs MySQLDirect (.NET)

 

Standard

 

 

User ID=root;Password=myPassword;Host=localhost;Port=3306;Database=myDataBase; Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;

Read more at Core Lab >>

And on the product page >>

 COPY TO CLIPBOARD

MySQLDriverCS (.NET)

 

Standard

 

 

Location=myServerAddress;Data Source=myDataBase;UserID=myUsername;Password=myPassword;Port=3306;Extended Properties="""";

十四、Lightbase

This is a compiled connection strings reference list on how to connect to Lightbase.

 

Standard

 

Standard

 

 

User=myUsername;Password=myPassword;UDB=USERBASE;Server=myServerAddress;

十五、Progress

This is a compiled connection strings reference list on how to connect to Progress.

 

ODBC

 

Standard

 

 

HOST=myServerAddress;DB=myDataBase;UID=myUsername;PWD=myPassword;PORT=2055;

十六、Interbase

This is a compiled connection strings reference list on how to connect to Interbase.

 

ODBC, Easysoft

 

Local computer

 

 

Driver={Easysoft IB6 ODBC};Server=localhost;Database=localhost:C:/mydatabase.gdb;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Remote Computer

 

 

Driver={Easysoft IB6 ODBC};Server=myServerAddress;Database=ComputerName:C:/mydatabase.gdb;Uid=myUsername;Pwd=myPassword;

Read more about this driver: Easysoft ODBC-Interbase driver >>

 COPY TO CLIPBOARD

ODBC, Intersolv

 

Local computer

 

 

Driver={INTERSOLV InterBase ODBC Driver (*.gdb)};Server=localhost;Database=localhost:C:/mydatabase.gdb;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Remote Computer

 

 

Driver={INTERSOLV InterBase ODBC Driver (*.gdb)};Server=myServerAddress;Database=ComputerName:C:/mydatabase.gdb;Uid=myUsername;Pwd=myPassword;

This driver are provided by DataDirect Technologies (formerly Intersolv) >>

 COPY TO CLIPBOARD

OLE DB, SIBPROvider

 

Standard

 

 

provider=sibprovider;location=localhost:;data source=c:/databases/gdbs/mygdb.gdb;user id=SYSDBA;Password=masterkey;

 

 COPY TO CLIPBOARD

Version 2.x

 

 

Provider=SIBPROvider.2;Data Source=localhost:c:/databases/gdbs/mygdb.gdb;Persist Security Info=False;

 

 COPY TO CLIPBOARD

Specifying character set

 

 

provider=sibprovider;location=localhost:;data source=c:/databases/gdbs/mygdb.gdb;user id=SYSDBA;Password=masterkey;character set=ISO8859_1;

 

 COPY TO CLIPBOARD

Specifying role

 

 

provider=sibprovider;location=localhost:;data source=c:/databases/gdbs/mygdb.gdb;user id=SYSDBA;Password=masterkey;role=DIGITADORES;

Read more about SIBPROvider >>

Read more about connecting to Interbase in this Borland Developer Network article >>

 COPY TO CLIPBOARD

十七、Postgre SQL

This is a compiled connection strings reference list on how to connect to Postgre SQL.

 

Core Labs PostgreSQLDirect (.NET)

 

Standard

 

 

User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=myDataBase;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;

Read more at Core Lab >>

And at the product page >>

 COPY TO CLIPBOARD

ODBC - PostgreSQL driver

 

Standard

 

 

Driver={PostgreSQL};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

ANSI

 

 

Driver={PostgreSQL ANSI};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

Unicode

 

 

Driver={PostgreSQL UNICODE};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

SSL

Secure sockets layer for this driver only works from version 8.0 and above.

 

Driver={PostgreSQL ANSI};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;sslmode=require;

Please note that sslmode=require is case sensitive, it should be written in lower case letters.

 COPY TO CLIPBOARD

Npgsql by pgFoundry (.NET)

 

SSL activated

 

 

Server=127.0.0.1;Port=5432;Userid=myUsername;Password=myPassword;Protocol=3;SSL=true; Pooling=true;MinPoolSize=3;MaxPoolSize=20;Encoding=UNICODE;Timeout=20;SslMode=Require;

 

 COPY TO CLIPBOARD

Without SSL

 

 

Server=127.0.0.1;Port=5432;Userid=myUsername;Password=myPassword;Protocol=3;SSL=false; Pooling=true;MinPoolSize=1;MaxPoolSize=20;Encoding=UNICODE;Timeout=15;SslMode=Disable;

Read more in the Npgsql User Manual >>

The pgFoundry website >>

 COPY TO CLIPBOARD

OLE DB - PgOleDb

 

Standard

PgOleDb requires a PQLib of version 7.4 or up and it also requires a backend of version 7.4 or up. Timestamps are only guarenteed to work with backends of version 8.0 and up.

 

Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;timeout=1000;

Other valid Provider values is "PostgreSQL" and "PostgreSQL.1"

 COPY TO CLIPBOARD

十八、Caché

This is a compiled connection strings reference list on how to connect to Caché.

 

ODBC

 

Standard

 

 

DRIVER={InterSystems ODBC};SERVER=myServerAddress;DATABASE=myDataBase;UID=myUsername;PWD=myPassword;

 

 COPY TO CLIPBOARD

Specifying port

 

 

DRIVER={InterSystems ODBC};SERVER=myServerAddress;PORT=12345;DATABASE=myDataBase;UID=myUsername;PWD=myPassword;

 

 COPY TO CLIPBOARD

Specifying protocol

 

 

DRIVER={InterSystems ODBC};SERVER=myServerAddress;PORT=12345;DATABASE=myDataBase;PROTOCOL=TCP;STATIC CURSORS=1;UID=myUsername;PWD=myPassword;

 

 COPY TO CLIPBOARD

十九、IBM DB2

This is a compiled connection strings reference list on how to connect to IBM DB2.

 

OLE DB, OleDbConnection (.NET) from Microsoft

 

TCP/IP

 

 

Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

APPC

 

 

Provider=DB2OLEDB;APPC Local LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

IBM's OLE DB Provider (shipped with IBM DB2 UDB v7 or above)

 

TCP/IP

 

 

Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP;Port=50000; Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

ODBC

 

Standard

 

 

Driver={IBM DB2 ODBC DRIVER};Database=myDataBase;Hostname=myServerAddress;Port=1234;Protocol=TCPIP;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

二十、Paradox

This is a compiled connection strings reference list on how to connect to Paradox.

 

ODBC

 

5.X

 

 

Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=c:/pathToDb/;Dbq=c:/pathToDb/;CollatingSequence=ASCII;

 

 COPY TO CLIPBOARD

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;

Please note that this one only supports read operations.

 COPY TO CLIPBOARD

Intersolv 3.11 ODBC Driver

 

7.X

DataDirect provides this Paradox 7.x table format driver with read-write capability. Note that Paradox tables remain frozen at table format 7.x, That means that software mentioning Paradox 8, 9, 10 tables are really always referencing format 7.x.

 

DSN=MyDSN;AUT=1;CT=7;DQ=0;FOC=0;IS=1;PW=myPassword;USF=1;ULQ=1;

Not all parameters are required, most of them can be set at the DSN system config.

Parameters definition
AUT - ApplicationUsingThreads
CT - CreateType
DB - Database
DSN - DataSourceName
DQ - DeferQueryEvaluation
FOC - FileOpenCache
IS - IntlSort
ND - NetDir
PW - Passwords
USF - UltraSafeCommit
ULQ - UseLongQualifiers

 COPY TO CLIPBOARD

OleDbConnection (.NET)

 

Standard

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/myDb;Extended Properties=Paradox 5.x;

Please note that you should only specify the folder where the database resides. Not the database name itself.

MS kb-article: How to use Paradox data with Access and Jet >>

 

 

 

 

 

 

 

第二部分:Data files

二十一、Excel 2007

This is a compiled connection strings reference list on how to connect to Excel 2007.

 

ACE OLEDB 12.0

 

Standard

 

 

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:/myFolder/myExcel2007file.xlsx;Extended Properties="Excel 12.0;HDR=YES";

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   /"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

 COPY TO CLIPBOARD

二十二、Access 2007

This is a compiled connection strings reference list on how to connect to Access 2007.

 

ACE OLEDB 12.0

 

Standard security

 

 

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/myFolder/myAccess2007file.accdb;Persist Security Info=False;

 

 COPY TO CLIPBOARD

With database password

This is the connection string to use when you have an Access 2007 database protected with a password using the "Set Database Password" function in Access.

 

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/myFolder/myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;

 

 COPY TO CLIPBOARD

 

二十三、DBF / FoxPro

This is a compiled connection strings reference list on how to connect to DBF / FoxPro.

For your foxpro 2.x DBF you do not need to use dBase or Jet driver, check out the "Visual FoxPro / FoxPro 2.x" section instead and use the VFP driver. Visual FoxPro ODBC and OLEDB drivers work for all Foxpro tables including the oldest foxbase tables and dBaseII, dBaseIII, Clipper files as well.

ODBC

 

Standard

 

 

Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:/mydbpath;

 

 COPY TO CLIPBOARD

Remote drives

 

 

Driver={Microsoft dBase Driver (*.dbf)};datasource=dBase Files;

SQL syntax example: "select * from //remotemachine/thefile.dbf"

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

Standard

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/folder;Extended Properties=dBASE IV;User ID=Admin;Password=;

 

 COPY TO CLIPBOARD

二十四、Excel

This is a compiled connection strings reference list on how to connect to Excel.

 

ODBC

 

Standard

 

 

Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:/MyExcel.xls;DefaultDir=c:/mypath;

SQL syntax "SELECT * FROM [sheet1$]". I.e. excel worksheet name followed by a "$" and wrapped in "[" "]" brackets.

 COPY TO CLIPBOARD

OLE DB

 

Standard

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   /"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

"IMEX=1;" tells the driver to always read "intermixed" (numbers, dates, strings etc) data columns as text. Note that this option might affect excel sheet write access negative.

SQL syntax "SELECT * FROM [sheet1$]". I.e. excel worksheet name followed by a "$" and wrapped in "[" "]" brackets.

Check out the [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Jet/4.0/Engines/Excel] located registry REG_DWORD "TypeGuessRows". That's the key to not letting Excel use only the first 8 rows to guess the columns data type. Set this value to 0 to scan all rows. This might hurt performance.

If the Excel workbook is protected by a password, you cannot open it for data access, even by supplying the correct password with your connection string. If you try, you receive the following error message: "Could not decrypt file."

 

 

二十五、Access

This is a compiled connection strings reference list on how to connect to Access.

 

ODBC

 

Standard Security

 

 

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/mydatabase.mdb;Uid=Admin;Pwd=;

 

 COPY TO CLIPBOARD

Workgroup

 

 

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/mydatabase.mdb;SystemDB=C:/mydatabase.mdw;

 

 COPY TO CLIPBOARD

Exclusive

 

 

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/mydatabase.mdb;Exclusive=1;Uid=admin;Pwd=;

 

 COPY TO CLIPBOARD

Enable admin statements

To enable certain programatically admin functions such as CREATE USER, CREATE GROUP, ADD USER, GRANT, REVOKE and DEFAULTS (when making CREATE TABLE statements) use this connection string.

 

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/mydatabase.mdb;Uid=Admin;Pwd=;ExtendedAnsiSQL=1;

 

 COPY TO CLIPBOARD

OLE DB, OleDbConnection (.NET)

 

Standard security

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/mydatabase.mdb;User Id=admin;Password=;

 

 COPY TO CLIPBOARD

With database password

This is the connection string to use when you have an access database protected with a password using the Set Database Password function in Access.

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;

 

 COPY TO CLIPBOARD

Workgroup (system database)

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/mydatabase.mdb;Jet OLEDB:System Database=system.mdw;

 

 COPY TO CLIPBOARD

Workgroup (system database) specifying username and password

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/mydatabase.mdb;Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword;

 

 COPY TO CLIPBOARD

二十六、SQLite

This is a compiled connection strings reference list on how to connect to SQLite.

 

Finisar.SQLite Data Provider

 

Standard

 

 

Data Source=mydb.db;Version=3;

The "Version" key can take value "2" for SQLite 2.x (default) or value "3" for SQLite 3.x

 COPY TO CLIPBOARD

Create a new database

 

 

Data Source=mydb.db;Version=3;New=True;

 

 COPY TO CLIPBOARD

Using compression

 

 

Data Source=mydb.db;Version=3;Compress=True;

 

 COPY TO CLIPBOARD

Specifying Cache Size

The Cache Size value represents the amount of data pages that are held in memory. Try increase this value for speed improvements but don't forget to keep track of the applications memory usage.

 

Data Source=mydb.db;Version=3;Cache Size=3000;

 

 COPY TO CLIPBOARD

ODBC

 

Standard

 

 

DRIVER=SQLite3 ODBC Driver;Database=mydb.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma= NORMAL ;StepAPI=0;

 

 COPY TO CLIPBOARD

二十七、Textfile

This is a compiled connection strings reference list on how to connect to Textfile.

 

ODBC

 

Standard

 

 

Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:/txtFilesFolder/;Extensions=asc,csv,tab,txt;

 

 COPY TO CLIPBOARD

OLE DB

 

Delimited columns

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/txtFilesFolder/;Extended Properties="text;HDR=Yes;FMT=Delimited";

The delimiter can be specified in the registry at the following location:
HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Jet / 4.0 / Engines / Text
"Format" = "TabDelimited"
or
"Format" = "Delimited(;)"

 COPY TO CLIPBOARD

Fixed length columns

 

 

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/txtFilesFolder/;Extended Properties="text;HDR=Yes;FMT=Fixed";

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

To specify each columns length use the Schema.ini file. See description below.

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   /"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

 COPY TO CLIPBOARD

Schema.ini

 

_

The schema information file tells the driver about the format of the text files. The file is always located in the same folder as the text files and must be named schema.ini.

 

[customers.txt]
Format=TabDelimited
ColNameHeader=True
MaxScanRows=0
CharacterSet=ANSI

[orders.txt]
Format=Delimited(;)
ColNameHeader=True
MaxScanRows=0
CharacterSet=ANSI

[invoices.txt]
Format=FixedLength
ColNameHeader=False
Col1=FieldName1 Integer Width 15
Col2=FieldName2 Date Width 15
Col3=FieldName3 Char Width 40
Col4=FieldName4 Float Width 20
CharacterSet=ANSI

Check out this article for more information on the schema.ini file >>

 COPY TO CLIPBOARD

二十八、Visual FoxPro / FoxPro 2.x

This is a compiled connection strings reference list on how to connect to Visual FoxPro / FoxPro 2.x.

For version 8 and up its recommended to use the OLEDB driver as the ODBC driver does not recognize autoincrement fields and does not support stored procedures. The last ODBC update was for VFP 6 (version 6.0.8167) which is also compatible with VFP 7.

OLE DB, OleDbConnection (.NET)

 

Database container (.DBC)

 

 

Provider=vfpoledb.1;Data Source=C:/MyDbFolder/MyDbContainer.dbc;Collating Sequence=machine;

 

 COPY TO CLIPBOARD

Free table directory

 

 

Provider=vfpoledb.1;Data Source=C:/MyDataDirectory/;Collating Sequence=general;

 

 COPY TO CLIPBOARD

Force the provider to use an ODBC DSN

 

 

Provider=vfpoledb.1;DSN=MyDSN;

Read more on Microsoft MSDN >>

 COPY TO CLIPBOARD

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;

Note that DELETED=NO will cause the driver to include deleted rows in the resultset. To not retrieve deleted rows specify DELETED=YES. The terminology is a bit confusing here, a more appropriate keyword would have been IGNORE DELETED instead of DELETED.

 COPY TO CLIPBOARD

Free Table directory

 

 

Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:/myvfpdbfolder;Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;

Note that DELETED=NO will cause the driver to include deleted rows in the resultset. To not retrieve deleted rows specify DELETED=YES. The terminology is a bit confusing here, a more appropriate keyword would have been IGNORE DELETED instead of DELETED.

"Collate=Machine" is the default setting. For other settings check the list of supported collating sequences >>

Microsoft Visual Foxpro site >>

 

二十九、Filemaker

This is a compiled connection strings reference list on how to connect to Filemaker.

 

ODBC

 

Standard

FileMaker's Remote Data Access Companion (RDAC) plug-in needs to be enabled, even if FileMaker is installed on the same machine as the application / website.

 

AllAsText=0;ApplicationUsingThreads=1;FetchChunkSize=100;Driver=FileMaker Pro;FileOpenCache=0;IntlSort=0;MaxTextlength=255;ServerAddress=127.0.0.1; TranslationOption=0;UseRemoteConnection=1;

 

 COPY TO CLIPBOARD

 

第三部分:Other

三十、MS Project

This is a compiled connection strings reference list on how to connect to MS Project.

 

Microsoft Project 2003 OLE DB

 

 

 

 

Provider=Microsoft.Project.OLEDB.11.0;Project Name=myProjectDatabaseFile.mpp;

 

 COPY TO CLIPBOARD

Microsoft Project 2002 OLE DB

 

 

 

 

Provider=Microsoft.Project.OLEDB.10.0;Project Name=myProjectDatabaseFile.mpp;

 

 COPY TO CLIPBOARD

Microsoft Project 2000 OLE DB

 

 

 

 

Provider=Microsoft.Project.OLEDB.9.0;Project Name=myProjectDatabaseFile.mpp;

 

 COPY TO CLIPBOARD

 

三十一、Lotus Notes

This is a compiled connection strings reference list on how to connect to Lotus Notes.

 

ODBC

 

Lotus Notes ODBC Driver

 

 

Driver={Lotus NotesSQL 3.01 (32-bit) ODBC DRIVER (*.nsf)};Server=myServerAddress;Database=dbPath/myDb.nsf;Uid=myUsername;Pwd=myPassword;

 

 COPY TO CLIPBOARD

三十二、Index Server

This is a compiled connection strings reference list on how to connect to Index Server.

 

OLE DB Provider for Index Server

 

Standard

 

 

Provider=MSIDXS;Data source=MyCatalog;

 

 COPY TO CLIPBOARD

Specifying the user locale

Specifies a unique 32-bit number (for example, 1033) that specifies preferences related to the user's language. These preferences indicate how dates and times are formatted, items are sorted alphabetically, strings are compared, and so on.

 

Provider=MSIDXS;Data source=MyCatalog;Locale Identifier=1033;

If this keyword is not specified, the default system locale identifier is used.

Read more about this provider here >>

 COPY TO CLIPBOARD

三十三、Active Directory

This is a compiled connection strings reference list on how to connect to Active Directory.

 

OLE DB, OleDbConnection (.NET)

 

Active Directory OLE DB provider

 

 

Provider=ADSDSOObject;

 

 COPY TO CLIPBOARD

Specifying user name and password

 

 

Provider=ADSDSOObject;User Id=myUsername;Password=myPassword;

Read more about querying Active Directory >>

 COPY TO CLIPBOARD

三十五、DSN

This is a compiled connection strings reference list on how to connect to DSN.

 

ODBC

 

DSN

 

 

DSN=myDsn;Uid=myUsername;Pwd=;

 

 COPY TO CLIPBOARD

File DSN

 

 

FILEDSN=c:/myData.dsn;Uid=myUsername;Pwd=;

 

 COPY TO CLIPBOARD

三十六、Exchange

Exchange

 

This is a compiled connection strings reference list on how to connect to Exchange.

 

OLE DB

 

Exchange OLE DB provider

 

 

ExOLEDB.DataSource

Specify store in the connection open command like this: conn.open "http://servername/mypublicstore"

Check out this article at msdn >> >>

and this one at Addison-Wesley >> >>

 COPY TO CLIPBOARD

ExDAV

 

ADO.NET

 

 

ExDAV.ExSearcher searcher = new ExDav.ExSearcher("http://mystore.edu/myresource");
searcher.Depth = ExDAV.ExRequest.ExRequestDepths.AllChildrenWithRoot;
searcher.ExProps.Add("DAV:", "creationdate");
ExDAV.ExResponse resp = searcher.Search("WHERE /"DAV:isfolder/" = true");

System.Data.DataSet ds = resp.GetDataSet("dsMyExDataSet", "dsMyExTableName");

Check out this article for details on how to access Exchange data from .NET >>

 COPY TO CLIPBOARD

三十七、UDL

 

 

This is a compiled connection strings reference list on how to connect to UDL.

 

UDL

 

UDL

 

 

File Name=c:/myDataLink.udl;

:-)

 COPY TO CLIPBOARD

 

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值