Thanks for your help. You are absloutly right. I am not using
..net. I am using VC++ 6.0.
Your answer works perfectly. I used timout option with connection
"William (Bill) Vaughn" <billvaRemoveThis@betav.com> wrote in message
news:uDGR8$9aHHA.3584@TK2MSFTNGP02.phx.gbl...
> Right. You're not using .NET at all (or so it seems). What you're seeing
is
> "by design". The default timeout for a connection is 1 minute. Generally,
> you can set this to 10-20 seconds using the provider-specific timeout key
> and get better response when the server is not there. You can also (in
..NET)
> easily code a Factory class that returns the visible servers and their
state
> so you would not have to wait at all--just connect to an active server.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
>
www.betav.com/blog/billva >
www.betav.com > Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> __________________________________
> Visit
www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> --------------------------------------------------------------------------
---------------------------------------------
>
> "Kumar" <balajik@spancotele.com> wrote in message
> news:uKahcS4aHHA.3960@TK2MSFTNGP04.phx.gbl...
> > Hi William,
> >
> > Thanks for your response.
> >
> > I am opening the SQL Server connection in one of the following
> > ways.
> >
> > 1. Without DSN
> > _bstr_t strCon(L"Provider=SQLOLEDB.1;" L"Persist Security Info=False;"
> > L"User ID=sa;" L"Password=shah;" L"Initial Catalog=Ravi;" L"Data Source=
> > 10.1.3.52;");
> >
> > hRes = m_pConnection->Open(strCon,"","",0);
> >
> > 2. Using DSN
> >
> > _bstr_t strCon(L"User ID=sa;" L"Password=shah;" L"Data Source=
Spanco;");
> >
> > hRes = m_pConnection->Open(strCon,"","",0);
> >
> > In both cases, assume SQL Server is not running during program
execution,
> > then the Database Connectivity with SQL Server will fail. In this case,
i
> > am
> > getting SQL error message after a long time as shown below. Means around
> > after 1 minute.
> >
> > [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not
> > exist
> > or access denied.
> >
> > I want to minimize this time. So how can i do this.
> >
> >
> >
> > "William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
> > news:OFfZTXxaHHA.4940@TK2MSFTNGP05.phx.gbl...
> >> If you're creating a DSN, it means you aren't using the right provider.
> >> SqlClient does not use/need a DSN. What do you mean by "DB Connectivity
> >> fails"?
> >>
> >> --
> >> ____________________________________
> >> William (Bill) Vaughn
> >> Author, Mentor, Consultant
> >> Microsoft MVP
> >> INETA Speaker
> >>
www.betav.com/blog/billva > >>
www.betav.com > >> Please reply only to the newsgroup so that others can benefit.
> >> This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >> __________________________________
> >> Visit
www.hitchhikerguides.net to get more information on my latest
book:
> >> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> >> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
>
>> -------------------------------------------------------------------------
-
> > ---------------------------------------------
> >>
> >> "Kumar" <balajik@spancotele.com> wrote in message
> >> news:ezQe62uaHHA.4520@TK2MSFTNGP06.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
> >> >
> >> >
> >>
> >>
> >
> >
>
>