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#?
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.
Christopher Reed, MCT, MCPD, MCTS, Microsoft Specialist, MTA
"The oxen are slow, but the earth is patient."
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.
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();
MattLong
Member
94 Points
104 Posts
Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 01, 2011 06:08 PM|LINK
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
Careed
All-Star
18798 Points
3649 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 01, 2011 06:13 PM|LINK
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.
"The oxen are slow, but the earth is patient."
Lannie
Contributor
3840 Points
749 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 01, 2011 09:14 PM|LINK
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.
MattLong
Member
94 Points
104 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 05, 2011 09:12 PM|LINK
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.
Careed
All-Star
18798 Points
3649 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 06, 2011 01:19 AM|LINK
Fix your cnstring line:
string cnstring = ConfigurationManager.ConnectionStrings["Oracle_Test"].ConnectionString;
"The oxen are slow, but the earth is patient."
MattLong
Member
94 Points
104 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 06, 2011 04:14 AM|LINK
I fixed the cnstring line, and I still get connection errors.
Careed
All-Star
18798 Points
3649 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 07, 2011 12:50 AM|LINK
Where is the error message occurring?
"The oxen are slow, but the earth is patient."
MattLong
Member
94 Points
104 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 07, 2011 05:32 AM|LINK
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
Careed
All-Star
18798 Points
3649 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 09, 2011 02:21 AM|LINK
Have you tried using the ODP.NET classes instead of using the System.Data.OleDb classes?
"The oxen are slow, but the earth is patient."
MattLong
Member
94 Points
104 Posts
Re: Which oracle Data provider should I use for C#/VS 2005 ASP 2.0?
Dec 09, 2011 03:10 AM|LINK
No, where can I get an example?