Last post Jan 25, 2012 07:46 AM by pure_m23
Jan 24, 2012 07:38 AM|pure_m23|LINK
I am using enterpriseLib 3.1. Below is a code snippet, which I am using to check whether conneciton is up or not.
But the code at times does not throw error even when I have disconnected the cable.
My app is database agnostic, so the code should work with any DB type.
Database _db = DatabaseFactory.CreateDatabase("Connection Config Key");
_conn = _db.CreateConnection();
break;//Connection is established
//No Connection... retry
Jan 24, 2012 07:55 AM|Rab Nawaz Khan|LINK
please visit the below URL, it may solve your problem
Jan 24, 2012 07:55 AM|ignatandrei|LINK
read at least a table.
Jan 25, 2012 07:31 AM|pure_m23|LINK
I am doing that now. I think the code snippet, which I have mentioned was failing to detect strictly whether the DB is up or not because the connection object is pooled. I want to know if there is any better way of achieving the same ?
Jan 25, 2012 07:46 AM|pure_m23|LINK
If you look at my code, I am doing the same, but what's happening is even if I disconnect the cable, the _con.Open executes without any error and the connection State also shows OPEN. I added one additional step where I am querying something from table,
this steps ensures if the DB is up or not. Don't think this soln is elegant but till I get a better soln, I will go with that approach.