TheSQLGuru
3/22/2007 2:41:00 PM
Only thing I know of is to reduce the timeout setting when you initially
connect. That is the setting it is causing it to take 60 seconds (default)
to come back with the error. Set it to 5-10 seconds initially, connect, then
reset it back to something reasonable so you don't get lots of disconnects
while queries are running. Hope this helps!
--
TheSQLGuru
President
Indicium Resources, Inc.
"Kumar" <balajik@spancotele.com> wrote in message
news:u8Qw6X4aHHA.4832@TK2MSFTNGP02.phx.gbl...
> Hi Kevin,
>
> Thanks for your response.
>
> Yes, i am doing the validation before retrieving data. I am
> checking whether the Database connection open Suceeded or Failed. If
> failed,
> it is showing error message after 1 minute time as shown below.
>
> [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does
> not exist or access denied.
>
>
> // Making connection string
> _bstr_t strCon(L"User ID=sa;" L"Password=shah;" L"Data Source= Spanco;");
>
> // Opening Database connection
>
> hRes = m_pConnection->Open(strCon,"","",0);
>
> //Checking Database connectivity status
>
> if(SUCCEEDED(hRes))
>
> {
>
> }
>
> else
>
> {
>
> }
>
> I want to minimize this time. So how can i do this.
>
>
> "Kevin G. Boles" <kgboles@earthlink.net> wrote in message
> news:OuKsGMvaHHA.2448@TK2MSFTNGP02.phx.gbl...
>> Are you verifying the validity of the connection before attempting to use
> it
>> the first time, or are you just openning it up and attempting to grab
>> records. I recommend the prior.
>>
>> --
>> TheSQLGuru
>> President
>> Indicium Resources, Inc.
>>
>> "Kumar" <balajik@spancotele.com> wrote in message
>> news:e%230Kn3uaHHA.4872@TK2MSFTNGP03.phx.gbl...
>> > Hi All,
>> >
>> > I am an VC++ programmer. I had written an VC++ application,
>> > which
>> > will fetch data from SQL Server. I am doing DB Connectivity by creating
> a
>> > DSN.
>> >
>> > My application works perfectly. But it lacked with need some
>> > performance issues when the DB Connectvity fails.
>> >
>> > If Database connectivity Succeeded, i am getting records
>> > immediately.
>> >
>> > If Database connectivity fails due to Network failure or
> Database
>> > Down etc..., it is taking more more time to display SQL Database
>> > Connectivity error.
>> >
>> > So how can i reduce this time when Database connectivity fails.
>> >
>> > --
>> >
>> > Regards & Thanks,
>> >
>> > B B S Kumar Katikireddy
>> > Software Engineer
>> > 9820474363
>> >
>> >
>>
>>
>
>