Altova DatabaseSpy 2024 Professional Edition

Sample ADO.NET Connection Strings

Home Prev Top Next

To set up an ADO.NET connection, you need to select an ADO.NET provider from the database connection dialog box and enter a connection string (see also Setting up an ADO.NET Connection). Sample ADO.NET connection strings for various databases are listed below under the .NET provider where they apply.

 

.NET Data Provider for Teradata

This provider can be downloaded from Teradata website (https://downloads.teradata.com/download/connectivity/net-data-provider-for-teradata). A sample connection string looks as follows:

 

Data Source=ServerAddress;User Id=user;Password=password;

 

.NET Framework Data Provider for IBM i

This provider is installed as part of IBM i Access Client Solutions - Windows Application Package. A sample connection string looks as follows:

 

DataSource=ServerAddress;UserID=user;Password=password;DataCompression=True;

 

For more information, see the ".NET Provider Technical Reference" help file included in the installation package above.

 

.NET Framework Data Provider for MySQL

This provider can be downloaded from MySQL website (https://dev.mysql.com/downloads/connector/net/). A sample connection string looks as follows:

 

Server=127.0.0.1;Uid=root;Pwd=12345;Database=test;

 

See also: https://dev.mysql.com/doc/connector-net/en/connector-net-programming-connecting-connection-string.html

 

.NET Framework Data Provider for SQL Server

A sample connection string looks as follows:

 

Data Source=DBSQLSERV;Initial Catalog=ProductsDB;User ID=dbuser;Password=dbpass

 

See also: https://msdn.microsoft.com/en-us/library/ms254500(v=vs.110).aspx

 

IBM DB2 Data Provider 10.1.2 for .NET Framework 4.0

 

Database=PRODUCTS;UID=user;Password=password;Server=localhost:50000;

 

Note:This provider is typically installed with the IBM DB2 Data Server Client package. If the provider is missing from the list of ADO.NET providers after installing IBM DB2 Data Server Client package, refer to the following technical note: https://www-01.ibm.com/support/docview.wss?uid=swg21429586.

 

See also: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.1.0/com.ibm.swg.im.dbclient.adonet.ref.doc/doc/DB2ConnectionClassConnectionStringProperty.html

 

Oracle Data Provider for .NET (ODP.NET)

The installation package which includes the ODP.NET provider can be downloaded from the Oracle website (see http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html). A sample connection string looks as follows:

 

Data Source=DSORCL;User Id=user;Password=password;

 

Where DSORCL is the name of the data source which points to an Oracle service name defined in the tnsnames.ora file, as described in Connecting to Oracle (ODBC).

 

To connect without configuring a service name in the tnsnames.ora file, use a string such as:

 

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=port)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=user;Password=password;

 

See also: https://docs.oracle.com/cd/B28359_01/win.111/b28375/featConnecting.htm

© 2017-2023 Altova GmbH