Last post Aug 28, 2013 12:43 AM by Win Paing
Aug 26, 2013 02:55 AM|Win Paing|LINK
I'm very new to .Net technology. I've been doing all the time on classic ASP only.
Now I have to make the website using ASP.Net with C#. We are going to use ASP.Net 4.5.
We are using IIS 8.0.
The database is Oracle DB and the Oracle client that we've installed in IIS is 32 bits client.
In classicASP, all the DB connection is being done by COM+ dlls.
Now, I don't know how to make DB connection from my C# page.
I would like to know the detail settings that I need to make for my .Net website. (which file that I need to add as a reference, etc...)
When I tried to connect to the DB directly from my .Net page GridView, I'm getting : "Attempt to load Oracle client libraries threw BadImageFormatException.
This problem will occur when running in 64 bit mode with 32 bit Oracle client components installed."
Is there any way to connect not using the oracle client ? Coz in my IIS server, the existing website is using ClassicASp and 32bits COMs dlls.
I found some discussions which we can connect to Oracle without using client. And they told to download Oracle ODAC and add as reference in the project.
But, the problem is, I cannot find an ODAC which is for .Net 4.5. I see only .Net 4 Version.
And also they are different with 32 and 64 bits versions.
So, which one should I install??
Thanks in advance.
Aug 27, 2013 10:44 AM|Rovastar|LINK
Very often you will want run your app pools in 32bit mode. So try everything in 32bit. fist.
I still now rarely see true native 64 bit applications and often they run better/fast in 32 bit (but that is another story)
Aug 28, 2013 12:43 AM|Win Paing|LINK
Hi, I tried to connect from aspx page. I installed Oracle 32 bits client on my development pc.
Connect it using connection string. And I can see that there is connection to DB. But I'm getting Error in execute sql command.
Can you please check it out.?
Here is my C# code:
public partial class dbTest2 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
using (OracleConnection objConn = new OracleConnection("Data Source = test; User ID=admin; Password=admin"))
OracleCommand objCmd = new OracleCommand();
objCmd.Connection = objConn;
objCmd.CommandText = "hq_getDotNet";
objCmd.CommandType = CommandType.StoredProcedure;
string studNo = "hello";
string password = "how are you";
objCmd.Parameters.Add("input1", OracleType.VarChar).Value = studNo;
objCmd.Parameters.Add("input2", OracleType.VarChar).Value = password;
objCmd.Parameters.Add("sdata", OracleType.VarChar,2000).Direction = ParameterDirection.ReturnValue;
objCmd.Parameters.Add("status", OracleType.VarChar, 2000).Direction = ParameterDirection.ReturnValue;
Response.Write("hello from Try block");
catch (Exception ex)
And here is the Oracle Procedure :
create or replace procedure hq_getDotNet
sdata out varchar2,
status out number
Here is the error I'm getting :
hello from Try blockSystem.Data.OracleClient.OracleException (0x80131938): ORA-06550: line 1, column 25: PLS-00103: Encountered the symbol "=" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <=
<> and or like LIKE2_ LIKE4_ LIKEC_ between || indicator multiset member SUBMULTISET_ ORA-06550: line 1, column 74: PLS-00103: Encountered the symbol ";" when expecting one of the following: . ( , * % & = - + < / > at in is mod remainder not rem <> or != or
~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ alter between || multi at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior
behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at dbTest2.Page_Load(Object sender, EventArgs e) in j:\Site Source\DotNetWebsite_1\dbTest2.aspx.cs:line 34
Any suggestion please.