• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

Cannot connect to oracle using OracleClient, asp.net

Hello experts, my web forms are on a windows2003 server, and I cannot connect to a Oracle 9i database using the Imports System.Data.OracleClient namespace.  I have tried everything from setting Acount permissions, to restarting IIS and rebooting our server, nothing seems to work.  My question is what other connection method can I use and how do I do it?  I have read some where that the OracleClient may not be supported on windows 2003.  I am using Asp.net version 1.1 with Visual Studio.net 2003
0
tentavarious
Asked:
tentavarious
  • 2
  • 2
1 Solution
 
nauman_ahmedCommented:
http://www.connectionstrings.com/

OLE DB, OleDbConnection (.NET)
--------------------------------------
Standard security:

"Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;"
This one's from Microsoft, the following are from Oracle
 Standard Security:

"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"



 Trusted Connection:

"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"

------------------------------
OracleConnection (.NET)
-----------------------------

 Standard:

"Data Source=MyOracleDB;Integrated Security=yes;"
This one works only with Oracle 8i release 3 or later
 Specifying username and password:

"Data Source=MyOracleDB;User Id=username;Password=passwd;Integrated Security=no;"
This one works only with Oracle 8i release 3 or later

Example:
---------------

C#:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "my connection string";
oOracleConn.Open();



VB.NET:
Imports System.Data.OracleClient
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "my connection string"
oOracleConn.Open()

-Nauman.
0
 
tentavariousAuthor Commented:
I tried using this method and could not get it to work.  Like I said above the  OracleConnect (.net) didnt work.  I ended up using a ODBC connection and it seemed to work.  What is the best method?  And using OLE DB what do i set the provider equal to?
This is how i got it to work.
   Dim objconn As New OdbcConnection("Driver={Microsoft ODBC for Oracle};Server=databasename;Uid=sfdd;Pwd=ddsf;")
 

OLE DB, OleDbConnection (.NET)
--------------------------------------
Standard security:

"Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;"
This one's from Microsoft, the following are from Oracle
 Standard Security:

"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"



 Trusted Connection:

"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
0
 
nauman_ahmedCommented:
Try the following:

Connecting to an Oracle Database Using ASP.NET—A Step-by-Step Tutorial
http://www.codeguru.com/Csharp/.NET/net_asp/tutorials/article.php/c8477/

Did you also try creating DataSource in ODBC?

-Nauman.
0
 
tentavariousAuthor Commented:
My odbc connection above worked fine.  My problem was I couldnt get it to work with oledb.  I was wondering what is the best method for connection to oracle database?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now