RE: How to handle the ODBC Error "Communication Link Failure?"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Your calls to get a connection handle and statement handle are incorrect.

SQLAllocHandle(SQL_HANDLE_DBC, &env, &conn);
should be
SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);
(Don't pass address of env handle)


SQLAllocHandle(SQL_HANDLE_STMT, &conn, &stmt);
should be
SQLAllocHandle(SQL_HANDLE_STMT, conn, &stmt);
(Don't pass address of conn handle)



--------------------
| From: "Satyajit" <satyajit_rai@xxxxxxxxxxxxxx>
| Newsgroups: microsoft.public.sqlserver.odbc
| Subject: How to handle the ODBC Error "Communication Link Failure?"
| Date: 20 Oct 2005 08:32:11 -0700
| Organization: http://groups.google.com
| Lines: 31
| Message-ID: <1129822331.153917.17630@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
| NNTP-Posting-Host: 203.199.164.2
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1129822336 22923 127.0.0.1 (20 Oct 2005
15:32:16 GMT)
| X-Complaints-To: groups-abuse@xxxxxxxxxx
| NNTP-Posting-Date: Thu, 20 Oct 2005 15:32:16 +0000 (UTC)
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US;
rv:1.7.12) Gecko/20050915 Firefox/1.0.7,gzip(gfe),gzip(gfe)
| X-HTTP-Via: 1.1 PTPROXY, 1.1 maproxy.persistent.co.in:80
(squid/2.5.STABLE5)
| Complaints-To: groups-abuse@xxxxxxxxxx
| Injection-Info: z14g2000cwz.googlegroups.com; posting-host=203.199.164.2;
| posting-account=llYfBA0AAADo7FoQV3qYFsmNLrpE0LdM
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.odbc:2880
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Hi All,
| I have an C++ application that uses ODBC to access SQL server. The
| application invokes the SQLAllocHandle() function to:
|
| 1. Get an Environment handle (Created only once)
| SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env)
|
| 2. Get Connection handle(s) by passing Environment handle
| SQLAllocHandle(SQL_HANDLE_DBC, &env, &conn);
|
| 3. Get Statement handle(s) by passing connection handle
| SQLAllocHandle(SQL_HANDLE_STMT, &conn, &stmt);
|
| The application has a pool of connection handles (as created in step 2)
| and reuses them. Now I am getting "Communication Link Failure" error
| from the return value of the call in step 2 or step 3 (most probably
| due to network failure).
|
| I want to handle this error by retrying for a fixed number of times
| before quitting the application.
|
| My questions is - Let's say I get the "Communication Link Failure"
| while trying to get statement handle (in step 3), will I need to
| recreate environment and connection handles before proceeding?
|
| In other words, do all handles get invalidated on Communication Link
| Failure?
|
| Regards,
| Satyajit
|
|

.



Relevant Pages

  • How to handle the ODBC Error "Communication Link Failure?"
    ... Get Connection handleby passing Environment handle ... My questions is - Let's say I get the "Communication Link Failure" ...
    (microsoft.public.sqlserver.odbc)
  • Re: Connection terminated by server problem
    ... connected=true and then only when I executes the query I get the ... "Communication link failure: Connection was terminated" error. ... How can I trap that kind of disconnects with ADOConnection? ...
    (borland.public.delphi.database.ado)
  • Re: A REAL LIVE Reverse Entropy Machine-Warning
    ... it spins a environment too ... evolutionary out of her fantastic summer. ... For Cathy the notebook's ... surprised, in connection with me it's cosmetic, whereas relative to you it's ...
    (sci.crypt)
  • Re: DTS Environment Control
    ... In the pakcgaes the connectionnames for the server stay the same. ... as I promote my packaged from DEV to TEST - If I'm ... > Test Environment: ... > 1) Connection Source to SQL TEST Box ...
    (microsoft.public.sqlserver.dts)
  • hardly any spanish solar supplier objects beings no doubt Ibrahims central grace
    ... rub satisfactory spells, do you let them? ... reserve after Rashid presumes the overall mainland's environment? ... furnish Andrew's beach in connection with sinks, ... surprised requirements spring no longer the valuable cabinet. ...
    (sci.crypt)