locked
Which oracle Data provider should I use for C#/VS 2005 ASP 2.0? RRS feed

  • Question

  • User921007156 posted

    Hi All,

    I have to make my first database connection to Oracle Version: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production, and I wanted to know. What is the best Data provider should I use, using VS 2005 ASP 2.0/C#?

    Thanks.

    Matt

    Thursday, December 1, 2011 2:08 PM

All replies

  • User1759999623 posted

    I would initially try to use the latest 11g provider from Oracle.  If this doesn't work (likely because it's too new for ASP.NET 2.0), then I would try using either the ODBC or OLEDB provider from .NET and try to connect to your Oracle database that way.

    Thursday, December 1, 2011 2:13 PM
  • User269602965 posted

    Lastest ODP.NET fully supports ASP.NET 2.0/3.5 communicating with either Oracle 10g or 11g, 32-bit or 64 bit database.

    You will have to install the 32-bit ODP.NET CLIENT in a new Oracle home on the web server or application server if you are running 32-bit compiled applications.

    If the database is 64-bit and on the same machine as the web server, you can still use the ODP.NET 32-bit CLIENT install in a new Oracle home and run 32-bit applications.

     

    Thursday, December 1, 2011 5:14 PM
  • User921007156 posted

    I'm having a diffucult time trying to make a database connection from my application. I can connect fine using other database tools, but get errors when try to open a connection within my ASP C# application. The following is one example of the code I'm trying to run.

    <--Web Config
    <connectionStrings>
            <add name="Oracle_Test" connectionString="Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=Matt;Password=Long;Data Source=TestDV;OLE DB Services=-4"/>
    <- Web Config

    using System.Data.OleDb;
    string cnstring = ConfigurationManager.ConnectionStrings["Oracle_Test"].ToString();
    System.Data.OleDb.OleDbConnection m_OracleDBConn = new OleDbConnection(cnstring);
    m_OracleDBConn.Open();

    // Code

    // Close Database
    m_OracleDBConn.Close();
    m_OracleDBConn.Dispose();

    Error Message I'm getting now: Unspecified error: E_FAIL(0x80004005)

    Thanks.

    Monday, December 5, 2011 5:12 PM
  • User1759999623 posted

    Fix your cnstring line:

    string cnstring = ConfigurationManager.ConnectionStrings["Oracle_Test"].ConnectionString;

    Monday, December 5, 2011 9:19 PM
  • User921007156 posted

    I fixed the cnstring line, and I still get connection errors.

    Tuesday, December 6, 2011 12:14 AM
  • User1759999623 posted

    Where is the error message occurring?

    Tuesday, December 6, 2011 8:50 PM
  • User921007156 posted

    I get the following error message.

    [OleDbException (0x80004005): MU???| ????T?]
           System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +968297
           System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
           System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
           System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4861516
           System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
           System.Data.OleDb.OleDbConnection.Open() +40


    Wednesday, December 7, 2011 1:32 AM
  • User1759999623 posted

    Have you tried using the ODP.NET classes instead of using the System.Data.OleDb classes?

    Thursday, December 8, 2011 10:21 PM
  • User921007156 posted

    No, where can I get an example?

    Thursday, December 8, 2011 11:10 PM
  • Friday, December 9, 2011 1:42 AM
  • User702049738 posted

    have you seen this thread below...it  will solve your current problem

    http://forums.asp.net/t/1723010.aspx/1?establishing+an+oracle+connection+in+asp+net

    Sunday, December 11, 2011 12:43 AM