Reputation: 432
I'm seriously stuck here with something obvious. I have an application that communicates with Oracle and MSSQL servers.
Both of them build their connection strings and then
try
{
connection.Open();
} catch ...
Now if i will enter wrong server name, SQL Server connection will timeout and i will happily handle an exception. But Oracle connection in C# does not seem to support timeout, so i will be never back from connection.Open() and my application will hang.
I found somewhat similar question, but it's not it, because answer is the same to what i'm doing and doesn't work.
check connection from C# app to oracle 10g database
Is it some weird bug or i should check my Oracle libs? Speaking of which OracleConnection is obsolete, should i use something else maybe(though i'd rather not)
So the thing i need is a way to handle wrong server name as easily as possible.
Edit 1: Now what i thought of till now was running connection.Open() in different thread and killing it on timeout.
Upvotes: 0
Views: 1041