Link to home
Start Free TrialLog in
Avatar of tentavarious
tentavarious

asked on

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
Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

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.
Avatar of tentavarious
tentavarious

ASKER

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;"
ASKER CERTIFIED SOLUTION
Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?