Using the Windows Registry


You can also use a custom key in the Windows registry to store the connection string, although this is not recommended due to deployment issues.

Advantages

Disadvantages

Using a Custom File


You can use a custom file to store the connection string. However, this technique offers no advantages and is not recommended.

Advantages

Disadvantages

Using Construction Arguments and the COM+ Catalog


You can store the database connection string in the COM+ catalog and have it automatically passed to your object by means of an object construction string. COM+ will call the object's Construct method immediately after instantiating the object, supplying the configured construction string.

Note This approach works only for serviced components. Consider it only if your managed components use other services, such as distributed transaction support or object pooling.

Advantages

Disadvantages

Important It is critical to secure connection strings. With SQL authentication, the connection contains a user name and password. If an attacker exploits source code vulnerability on the Web server or gains access to the configuration store, the database will be vulnerable. To prevent this, connection strings should be encrypted.


Shashi Ray