Trouble connecting to Oracle database from C#

K

kimtherkelsen

Hi,
I use the System.Data.OleDb.OleDbConnection class to establish a
connection to a Oracle 10G database.
The dsn connection string I use look like this:

dsn=provider="MSDAORA.1";User ID=test;Data Source="172.30.0.25/
JBOS";Password=test;

This works fine in Windows XP and Windows server 2003 but I have a
customer that try to connect to the database from a Windows 2000
machine and gets the following error:

ORA-06401: NETCMN: Invalid driver designator

I have tried to reproduce the error on a VMWARE Windows 2000 sp4
machine (that does not have a Oracle server or client installed) but
there it works after installing MDAC version 2.8. I am not able to
reproduce the error...

Do you have any idea what is wrong?

I include the the following DLL files with the code:
oraociei10.dll, oci.dll, oraocci10.dll, ociw32.dll, orannzsbb10.dll

Best regards,
Kim Therkelsen
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

I use the System.Data.OleDb.OleDbConnection class to establish a
connection to a Oracle 10G database.
The dsn connection string I use look like this:

dsn=provider="MSDAORA.1";User ID=test;Data Source="172.30.0.25/
JBOS";Password=test;

This works fine in Windows XP and Windows server 2003 but I have a
customer that try to connect to the database from a Windows 2000
machine and gets the following error:

ORA-06401: NETCMN: Invalid driver designator

I have tried to reproduce the error on a VMWARE Windows 2000 sp4
machine (that does not have a Oracle server or client installed) but
there it works after installing MDAC version 2.8. I am not able to
reproduce the error...

Do you have any idea what is wrong?

I include the the following DLL files with the code:
oraociei10.dll, oci.dll, oraocci10.dll, ociw32.dll, orannzsbb10.dll

A googling finds a lot of references to this problem.

Many of them indicate a mismatch between connection string
and tnsnames.ora.

So you should check that.

An interesting twist is:
http://www.phpbuilder.com/board/archive/index.php/t-6705.html

Arne

PS: Why not use an Oracle ADO.NET provider instead of OLE DB ?
 
K

kimtherkelsen

Hi!

As I wrote, I do not intend to install a Oracle client on the PCs if I
can avoid it. So there is no tnsnames.ora file on the machine. The
application uses the included dlls. If I use the exact same settings
on my test w2k machine without Oracle client or server installed, it
works. I think it perhaps would work if I also installed a Oracle
client on all the machines and then used the tnsname in the connection
string but that is a lot of work and a lot of software for such a
simple task.

Actually I did not write the code myself but if it makes things easier
to use Oracle ADO.NET instead of OLE DB, I will change it.

/Kim
 
C

Christof Nordiek

Hi,
I use the System.Data.OleDb.OleDbConnection class to establish a
connection to a Oracle 10G database.
The dsn connection string I use look like this:

dsn=provider="MSDAORA.1";User ID=test;Data Source="172.30.0.25/
JBOS";Password=test;

This works fine in Windows XP and Windows server 2003 but I have a
customer that try to connect to the database from a Windows 2000
machine and gets the following error:

ORA-06401: NETCMN: Invalid driver designator

This is a error message from Oracle. Since OLEDB is not C# specific. I
suppose you should ask this in an Oracle group.

Christof
 
K

kimtherkelsen

We solved the problem!

A ORACLE_HOME environment path had to be set to point at the folder
containing the dlls. Otherwise this specific PC would look for the
libraries in other places because it previously had a Oracle 9i client
installed.

Best regards,
Kim Therkelsen
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

As I wrote, I do not intend to install a Oracle client on the PCs if I
can avoid it. So there is no tnsnames.ora file on the machine. The
application uses the included dlls. If I use the exact same settings
on my test w2k machine without Oracle client or server installed, it
works. I think it perhaps would work if I also installed a Oracle
client on all the machines and then used the tnsname in the connection
string but that is a lot of work and a lot of software for such a
simple task.

Actually I did not write the code myself but if it makes things easier
to use Oracle ADO.NET instead of OLE DB, I will change it.

I believe that all Oracle only supports solutions with
Oracle client installed on PC's (except for Java JDBC thin
driver, which is probably not so relevant for you).

Arne
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top