By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

When Connecting To A Remote Oracle DataBase: Socket Exception: No connection could be

P: 4
Hi All!

I'm trying to connect to a remote oracle database using the OracleConnection within . Whenever I try connecting I get a SocketException:No connection could be made because the target machine actively refused it. error.

Currently my connectionstring is as follows:

OracleConnection1.ConnectionString = "Provider=OraOLEDB.Oracle;SERVER=(DESCRIPTION=(ADD RESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort))(CON NECT_DATA=(SERVICE_NAME=" & dbName & ")));uid=" & userName & ";pwd=" & password & ";"

Note: The myHost and myPort were taken from the tnsNames.ora file on the machine hosting the database. The dbName, userName and password are provided programatically and inserted to the above string. I know the port must be open on the server because other remote processes can access it, mine just can't.

I can't for the life of me figure out what I'm doing wrong. Any help you could provide would be greatly appreciated.

Oct 25 '07 #1
Share this Question
Share on Google+
7 Replies

Expert 5K+
P: 7,872
"the target machine actively refused it." error means you tried to connect to the server at the specified port, but the server says there's nobody listening at that port.
(It's possible that the fire blocked it, but it should give different message)

Are you sure your oracle is setup to receive outside connections (and not just connections from the same machine it's on)?
Do you have access to the connection strings used by those other processes?

Is it on a domain? Do you have domain privledges enough to access the resource?
Oct 25 '07 #2

P: 4
Thanks for the quick reply!

Yes, I'm sure that it's set up to receive outside connections because there are other webservices which already connect to the same database. No, unfortunately I don't have access to these other webservices (that would make my job WAY too easy, don't you think?). And yes, I should have domain access. That's why I've been pulling out my hair with this all week!
Oct 25 '07 #3

Expert 5K+
P: 7,872
If you use the connection wizzard in the designer, are you able to make a successfull connection to the oracle server?
Oct 25 '07 #4

P: 4
No, it's a pretty complicated situation. The way things work, the development system doesn't have access to the database (which makes it hard to develop, trust me), but the client systems where the webservice is called, do have appropriate access. So, it's not just a matter of using the wizard because I know that connection will be denied.
Oct 26 '07 #5

Expert 5K+
P: 7,872
The webservice is hosted a computer with permision to oracle though?
Oct 26 '07 #6

P: 4
Yep, that's my understanding. There are other processes which access the database from these PC's, but their code is being guarded like a national secret, so I'm on my own to figure it out.

The service is actually hosted on the same computer as the database, and other clients then call this webservice which is supposed to be able to access the database.
Oct 26 '07 #7

Expert 5K+
P: 7,872
since you can't use it on the development pc, have you tried referencing localhost (or in your connection string instead of the computer name?
Oct 26 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Browse more .NET Framework Questions on Bytes