Here’s a useful tip for managing Oracle connections: Instead of relying on the tnsnames.ora
file, which can be cumbersome to configure and distribute, you can include the connection details directly in your connection string. This way, all necessary information is contained within your application’s configuration file.
Here’s an example connection string:
<connectionStrings>
<add name="ConnectionName"
connectionString="Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = hostname.host.se)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = servicename)));User Id=[your user];Password=[your pwd];"
providerName="Oracle.DataAccess.Client" />
</connectionStrings>
This approach simplifies deployment by consolidating configuration into a single place. I find this method quite convenient!