How to connect ASP.Net with Oracle Database?

Discussion in 'ASP .Net' started by ´ï´ï, Apr 19, 2005.

  1. ´ï´ï

    ´ï´ï Guest

    How to connect asp.net with Oracle Database?
    Where and How to? Thanks very much.
     
    ´ï´ï, Apr 19, 2005
    #1
    1. Advertisements

  2. 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, Apr 19, 2005
    #2
    1. Advertisements

  3. ´ï´ï

    Mikeda Guest

    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" <> ????
    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()
     
    Mikeda, Apr 19, 2005
    #3
  4. 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!
    ***********************************************
     
    Cowboy \(Gregory A. Beamer\), Apr 19, 2005
    #4
  5. re:
    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, Apr 19, 2005
    #5
  6. ´ï´ï

    Mikeda Guest

    Oh?Thanks very much~~I will try later..
     
    Mikeda, Apr 20, 2005
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.