SQL Server 7.0 connection strings

.NET Framework Data Provider for SQL Server

Problems connecting?
Get answer in the SQL Server 7.0 Q & A forum

SQL Server Native Client 10.0 OLE DB Provider

SQL Native Client 9.0 OLE DB Provider

Microsoft OLE DB Provider for SQL Server

  • Standard Security

    Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;
    User Id
    =myUsername;Password=myPassword;
  • 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.

  • Connecting to an SQL Server instance

    The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.

    Provider=sqloledb;Data Source=myServerName\theInstanceName;
    Initial Catalog
    =myDataBase;Integrated Security=SSPI;
  • 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

    oConn.Open "Data Source=myServerAddress;Initial Catalog=myDataBase;"
  • 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. Read more in the article How to define which network protocol to use.

  • Disable connection pooling

    This one is usefull when receving errors "sp_setapprole was not invoked correctly." (7.0) or "General network error. Check your network documentation" (2000) when connecting using an application role enabled connection. Application pooling (or OLE DB resource pooling) is on by default. Disabling it can help on this error.

    Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;
    User ID
    =myUsername;Password=myPassword;OLE DB Services=-2;

SQLXML 3.0 OLEDB Provider

  • Using SQL Server Ole Db

    The SQLXML version 3.0 restricts the data provider to SQLOLEDB only.

    Provider=SQLXMLOLEDB.3.0;Data Provider=SQLOLEDB;Data Source=myServerAddress;
    Initial Catalog
    =myDataBase;User Id=myUsername;Password=myPassword;

.NET Framework Data Provider for OLE DB

  • Use an OLE DB provider from .NET

    Provider=any oledb provider's name;OledbKey1=someValue;OledbKey2=someValue;

    See the respective OLEDB provider's connection strings options. The .net OleDbConnection will just pass on the connection string to the specified OLEDB provider. Read more here.

SQL Server Native Client 10.0 ODBC Driver

SQL Native Client 9.0 ODBC Driver

Microsoft SQL Server ODBC Driver

.NET Framework Data Provider for ODBC

  • Use an ODBC driver from .NET

    Driver={any odbc driver's name};OdbcKey1=someValue;OdbcKey2=someValue;

    See the respective ODBC driver's connection strings options. The .net OdbcConnection will just pass on the connection string to the specified ODBC driver. Read more here.

MSDataShape

Connect

Q&Aask question »

Articlesread all »

Connect

Articlesread all »

Didn't find your connection string?

Start over from the connection string reference index - or try a search!

In the Q&A forums you can ask your own question and let somebody help you.

The knowledge articles contains solutions and guides.