How to connect ASP.Net with Oracle Database?

  • Thread starter Thread starter ´ï´ï
  • Start date Start date
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

Declare the OracleConnection:

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

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



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
Thanks very much.
But if i wanna use ODP.Net to connect with ASP.Net?
Is it better then yours?
Then I am beginner.Thank you.

"Juan T. Llibre" <[email protected]> ????
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

Declare the OracleConnection:

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

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



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
To answer your question I would say "yes", ODP.NET is better for working
with Oracle. The programming model is the same in most tasks and similar in
the rest and it is tuned to Oracle. There are a few instances where
OracleClient is better, due to having to work with both .NET and Java, but
it is generally neglegible. For the newest Oracle database (10g), I do not
believe you can use the OracleClient that ships with Visual Studio as the
Oracle internals have changed.

The code that Juan shared is very close to ODP.NET and you can download
samples of code for ODP.NET from the same site you download ODP.NET:
http://otn.oracle.com

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think outside the box!
***********************************************
 
re:
But if i wanna use ODP.Net to connect with ASP.Net?
Is it better then yours?

Those *are* the connection strings for the
..NET Framework Data Provider for Oracle (ODP.NET).

You can download it at:
http://www.microsoft.com/downloads/...29-17dc-45ea-bfb3-076d1c052524&displaylang=en

And learn a bit more about it at:
http://www.c-sharpcorner.com/Code/2004/Feb/ODP.NET02.asp

You could also use OleDb :

This one's from Microsoft :
"Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;"

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;"

Or, you could also use OraDirect : http://www.crlab.com/oranet/

OraDirect .NET supports Oracle 10g, 9i, 8i and 8.0,
including Personal and Lite editions.

Their provider works with .NET Framework 1.0, 1.1, and 2.0.
It will cost you $$$, though. ( $100 to $150 ).




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
Oh?Thanks very much~~I will try later..
Cowboy (Gregory A. Beamer) said:
To answer your question I would say "yes", ODP.NET is better for working
with Oracle. The programming model is the same in most tasks and similar in
the rest and it is tuned to Oracle. There are a few instances where
OracleClient is better, due to having to work with both .NET and Java, but
it is generally neglegible. For the newest Oracle database (10g), I do not
believe you can use the OracleClient that ships with Visual Studio as the
Oracle internals have changed.

The code that Juan shared is very close to ODP.NET and you can download
samples of code for ODP.NET from the same site you download ODP.NET:
http://otn.oracle.com

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think outside the box!
***********************************************
 
Back
Top