Generic .Net developer question
604519Mar 23 2010 — edited Mar 23 2010Hi guys,
I have been developing applications which connect to different dbs and different versions of those DBS.
In that respect I am a little confused about how to setup my references to the oracle providers.
Here is what I currently do:
I install oracle client on my machine then I go to C:\oraclexe\app\oracle\product\10.2.0\server\BIN and I copy Oracle.DataAccess.dll to a Lib folder within my solution. Then I add a reference in my project to Oracle.DataAccess.dll dll from my lib folder.
Now when I deploy the application on a machine which does not have Oracle CLient installed it is still able to access oracle.
My first question is is this how am I supposed to do it. Would Oracle.DataAccess.dll be able to connect to different versions of oracle ? Would it work for x64 bit oracle installation and for 32 bit one ?
My second question is I currently have a problem connection to oracle using the above mentioned way of doing things.
I have a simple windows forms application which just opens a connection:
private void button4_Click(object sender, EventArgs e)
{
try
{
using (OracleConnection con = new OracleConnection(textBox1.Text))
{
con.Open();
}
MessageBox.Show("Success");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I deploy that application along with a copy of Oracle.DataAccess.dll on a x64 bit machine with oracle installed on it (not only client but the whole db) I run it and I get the following error:
An attempt was made to load program with incorrect format xxxx.
I tried deleting Oracle.DataAccess.dll and I get the following error:
Could not load file or assembly Oracle.DataAccess.dll, public key .....
I tried compiling my .Net app with x64 flag with Any CPU and with x86.
My environment is windows 7 x64 and the oracle installation is x64 bit.
Thank you for any suggestions you might give me!
Regards,
Kostadin Mitev