hello,
i have visual studio 2005 installed in my computer and i am using oracle as server. i am not able to write the connection string in the web.config.
from control panel-> add administrative tool->data odbc->system dsn
i have added a dsn 'data'.
database name is employee
please help me. it's very urgent.

Dani AI

Generated

: quick practical options based on your setup (VS2005, Oracle, System DSN named data, DB = employee). As asked, first confirm whether the problem is "where to put the string" or "cannot save web.config" (permissions). As noted, you can either use the ODBC DSN you created, or use a native Oracle provider (Microsoft's System.Data.OracleClient existed in .NET 2.0 but is deprecated; Oracle's ODP.NET is the recommended provider).

ODBC (use the DSN you created). Put this inside the <connectionStrings> section of web.config and be sure providerName is System.Data.Odbc:

<connectionStrings>
  <add name="OracleDsn" connectionString="Dsn=data;Uid=YOUR_USER;Pwd=YOUR_PASSWORD;" providerName="System.Data.Odbc" />
</connectionStrings>

Native Oracle provider (better): use ODP.NET and the provider Oracle.DataAccess.Client. You must install the Oracle client/ODP.NET on the machine and add a reference to Oracle.DataAccess.dll in the project. Example using a TNS alias employee or a full DESCRIPTION:

<connectionStrings>
  <add name="OracleDirect" connectionString="User Id=YOUR_USER;Password=YOUR_PASSWORD;Data Source=employee;" providerName="Oracle.DataAccess.Client" />
</connectionStrings>

Troubleshooting checklist: edit the correct web.config (project root), check file write permissions, test the DSN from ODBC Admin (and run the correct 32-bit ODBC admin on 64-bit Windows: %windir%\SysWOW64\odbcad32.exe), verify tnsnames.ora if using a TNS alias, install matching Oracle client bitness for your app, and examine the exact exception/message in Event Viewer or the ASP.NET error page. For web.config schema and more connection-string examples see the Microsoft docs on connectionStrings and Oracle samples at ConnectionStrings.com: and Oracle examples.

Recommended Answers

All 2 Replies

Why aren't you able to write it? You don't know where to put it or you're getting file system errors .... ?

If you are using Oracle database, then you can use System.Data.OracleClient namespace. This namespace does not require ODBC DSN name. I suggest not to use OleDb and Odbc namesspaces which may need to create DSN names.

But Microsoft announced it is deprecating Microsoft OracleClient(System.Data.OracleClient namespace), a Microsoft-built .NET data provider for the Oracle Database because third-party providers, such as Oracle, offer superior ADO.NET providers. For existing Microsoft OracleClient developers, this is an opportunity to take a fresh look at the Oracle Data Provider for .NET (ODP.NET), which is free to download from OTN. In recent years, Oracle has added new features to ODP.NET for performance tuning, user-defined types, advanced queuing, RAC connection pooling, and supporting multiple ODP.NET client versions simultaneously on the same machine. If you use ODP.NET, then you need to use Oracle.DataAccess.Client namespace.

Also visit this link. http://www.oracle.com/technology/pub/articles/cook-vs08.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.