Connecting to Oracle in Vs.net 2005

So all i'm trying to do is query an oracle DB from vs.net.  I get a slew of error messages depending on the connection string/driver/prodiver i use.
What gets me is that i can ping the server, tsnping, connect through Data Sources(ODBC), and Oracle's 'SQL Developer' tool but I can't using Vs.
My latest effort has me at
Dim oSQLConn As New OleDb.OleDbConnection
oSQLConn.ConnectionString = "Provider=OraOLEDB.Oracle;{DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=DEV.X.X)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ARC)(SID=ARC.X.X)))"
oSQLConn.Open()
Which gives me "ORA-12560: TNS:protocol adapter error"
That connection string was taken straight out of the tnsnames.ora created by Sql developer.
Please keep in mind I'm a novice at anything oracle.
cvoutourAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
If you have the tnsnames.ora, then you could use the simple form of the connection string, and the System.Data.OracleClient namespace:

Oracle connection strings:
http://www.connectionstrings.com/?carrier=oracle

Data Source=MyOracleDB;Integrated Security=yes;


Imports System.Data.OracleClient
 
...
 
Public Function GetReceivedDateCount() As Integer
 
Dim connectionString As String = ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString
 
Using connection As New OracleConnection(connectionString))
   connection.Open()
   Dim commandText As String = "Select Count(Received_Date) As CountDates From Receiving"
   Using command As New OracleCommand(commandText, connection)
        Dim countDates As Integer = command.ExecuteScalar()
        Return countDates
   End Using
End Using
 
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cvoutourAuthor Commented:
I don't have a 'system.data.oracleclient' namespace available.
i've been to the connectionstrings.com site many times, tried every example there.
0
cvoutourAuthor Commented:
Correction: I have the system.data.oracleclient namespace, i just get an error on
Dim connectionString As String = ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString
0
Bob LearnedCommented:
That was just an example of getting a connection string from a configuration file.  You would need to add a reference to the System.Configuration.dll, and a Imports System.Configuration to your project and code module.

Bob
0
cvoutourAuthor Commented:
I had to tweak it a bit, replacing the connectionString with the info i had listed above, but the system.data.oracleclient namespace seems to be what i needed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.