OleDBConnection & Oracle

Scorpio

Member
Joined
Sep 11, 2003
Messages
8
Hi guys, i have problems with an application that should connect either to a SQL2000 server or to an Oracle Server
The connection to the SQL2000 server work fine but i have the following error when i try to open the connection to the Oracle Server
ORA-12514 : TNS listener could not resolve SERVICE_NAME given in connect descriptor

I guess that the error is in the connectionstring for Oracle but i cant find what i need to put

Here is the related code :

Public Shared MyConnection As New System.Data.OleDb.OleDbConnection()

FOR SQL2000
MyConnection.ConnectionString = "Provider=SQLOLEDB;Data Source=" & ServerName & ";Initial Catalog=" & DBName & ";Integrated Security=SSPI;"

FOR ORACLE
MyConnection.ConnectionString = "Provider=MSDAORA;Data Source=" & ServerName & ";Integrated Security=SSPI;password=xxxx;User ID=xxxx"

MyConnection.Open()
 
A second try gave the error

Error :
Multiple-Step OLE DB operation generated errors.Check each OLEDB status value, if available.
No Work was done.

Here is the connectionstring i used
MyConnection.ConnectionString = "Provider=MSDAORA; Data Source=" & ServerName & "; Initial Catalog= " & DBName & ";User ID=xxx; Password=yyy"
MyConnection.open
 
Did you have configured your oracle client ? You can simply check this by opening a command shell and type tnsping servername where servername is the name of your database. If you didn`t get an answer, you have to check the file TNSNAMES.ORA located in the subdir /network/ADMIN of your oracle clients installation directory.
 
Try using this simple connection string :

MyConnection.ConnectionString = "Provider=MSDAORA;Data Source=TNSNAME;password=xxx;User ID=xxx"

where TNSNAME is the TNSName of your DB. You can`t use your servers NETBIOS- or DNS-name as you do in the connectionstring for SQL-Server. Instead you have to use the TNSName. Also, I don`t think that the Initial Catalog-parameter is supported by MSDAORA-provider.
 
Back
Top