Showing posts with label written. Show all posts
Showing posts with label written. Show all posts

Wednesday, March 21, 2012

ODBC Connection failure

My application (written in a proprietary old 4GL) is connecting to a SQL 2000 database via ODBC

This works fine nearly all the time, but occasionally, it throws the following error when trying to connect :

Connection Failed

SQLState '01000'

SQL Server Error: 10060

[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]Connection Open(Connect()).

Connection Failed:

SQLState '08001'

SQL Server Error: 17

[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not exist or access denied.

This error is displayed in a Windows dialog box. When the OK button on this dialog is clicked, it throws up a login/password box. When this is filled in and submitted, the connection is usually made cleanly and the application continues.

The big problem is that the application is an unattended service, and this dialog can go unnoticed for quite a while.

If these dialogs are 'Cancelled' rather than 'OK'd, the 4GL receives the error and arranges to re-try the connection itself.

Is ODBC responsible for popping up the interactive dialog, and, if so, can I do anything to force it to return an error instead ?

Hi Steve,

Interesting situation. The error 10060 means this: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. So you are probably experiencing a timeout in one of the socket-relation ops, most probably connect() (different from the SQL netlib's Connect() mentioned above).

The login popup is implemented by the SQL ODBC driver. You are probably using SQLDriverConnect in ODBC? It has a parameter "DriverCompletion", which could be:

SQL_DRIVER_PROMPT
SQL_DRIVER_COMPLETE
SQL_DRIVER_COMPLETE_REQUIRED
SQL_DRIVER_NOPROMPT

You probably have passed the first one (SQL_DRIVER_PROMPT). In order to make sure the SQLDriverConnect fails without popping up the troublesome dialog, you need to pass the SQL_DRIVER_NOPROMPT. I truly hope you are able to modify the 4GL application?

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Thanks a lot Jivko.

Unfortunately, the only parameter the 4GL allows me to specify is the DSN name.

I'll be on to the vendor's support desk rather forcefully first thing on Monday morning - thanks for the Ammo!

Monday, March 19, 2012

ODBC --Call Failed exception in application?

Hi, everyone! I hope I'm putting this in the correct forum... forgive me if I haven't!
I've written a neat little app in Visual C# that connects to an MSAccess 2003 database. Because of the really great functionality of ADO.NET, I was able to circumvent a lot of the concurrent connection limitations of Access by using DataSets - alas, I was only delaying the inevitable transition to SQL Server 2000
Since the internal dataset fills in my C# app are written for OLE, and since I've already configured it to connect to the Access database, I was really hopingthat I could just use a linked table to the exported data on SQL Server. However, when I did just this, I got a "ODBC --Call Failed" unhandled exception in my application when I tried to make a simple data change and save it back to the database - no other descriptive error numbers or anything. It appears to be connecting, as I can navigate records, I just cannot make a single change to them, or add new records.
- The changes I made do not propogate, so the MSKB regarding ODBC and cursors isn't the solution
- I did remember to set a PK when I exported from Access to SQL Server 2000
- It's {most likely?} not a permissions issue; I'm in as Administrator, with the ODBC connection set up to use NT Authentication
- I've got SQL Server 2000 running SP3a as well as the latest version of JET running on my 2k3 Server
Any help would be greatly appreciated!

Hi,

as long as Access doenst have a primry key defined on the table it isn′t able to do an update / insert. Try to open the access database and insert a new row in th linked table, i guess it is greyed. Define a PK on the appriate columns and you′ll be fine.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||Jens,
Thanks for the response. Unfortunately, I had already defined the PK, and it's showing up in Access. I can add records/edit changes in the database using the MSAccess UI... it's just when my C# ADO.NET app tries to do connect to the MS Access file that the problems start manifesting.
Any other ideas?
|||

http://support.microsoft.com/?scid=kb;en-us;303257&spid=2509&sid=49

HTH

ODBC --Call Failed exception in application?

Hi, everyone! I hope I'm putting this in the correct forum... forgive me if I haven't!
I've written a neat little app in Visual C# that connects to an MSAccess 2003 database. Because of the really great functionality of ADO.NET, I was able to circumvent a lot of the concurrent connection limitations of Access by using DataSets - alas, I was only delaying the inevitable transition to SQL Server 2000
Since the internal dataset fills in my C# app are written for OLE, and since I've already configured it to connect to the Access database, I was really hopingthat I could just use a linked table to the exported data on SQL Server. However, when I did just this, I got a "ODBC --Call Failed" unhandled exception in my application when I tried to make a simple data change and save it back to the database - no other descriptive error numbers or anything. It appears to be connecting, as I can navigate records, I just cannot make a single change to them, or add new records.
- The changes I made do not propogate, so the MSKB regarding ODBC and cursors isn't the solution
- I did remember to set a PK when I exported from Access to SQL Server 2000
- It's {most likely?} not a permissions issue; I'm in as Administrator, with the ODBC connection set up to use NT Authentication
- I've got SQL Server 2000 running SP3a as well as the latest version of JET running on my 2k3 Server
Any help would be greatly appreciated!

Hi,

as long as Access doenst have a primry key defined on the table it isn′t able to do an update / insert. Try to open the access database and insert a new row in th linked table, i guess it is greyed. Define a PK on the appriate columns and you′ll be fine.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||Jens,
Thanks for the response. Unfortunately, I had already defined the PK, and it's showing up in Access. I can add records/edit changes in the database using the MSAccess UI... it's just when my C# ADO.NET app tries to do connect to the MS Access file that the problems start manifesting.
Any other ideas?
|||

http://support.microsoft.com/?scid=kb;en-us;303257&spid=2509&sid=49

HTH

ODBC BCP Error Handling in C++

(Please let me know if there is a better group to post this on...)
I have written a C++ program that BCP's data into SQL Server using ODBC.
I'm currently at the point that I am testing worst-case scenarios. In the
scenario that while the BCP is running, I pull the network cable from SQL
server, I get failed calls to bcp_sendrow, but I am unable to get details on
the error. I have tried calling SQLGetDiagRec with handle types of
SQL_HANDLE_ENV, SQL_HANDLE_DBC, and SQL_HANDLE_STMT.
Any suggestions would be appreciated.
Thanks.
-Thomas
I figured it out myself. In case anyone is interested, here is how to
determine whether the connection to the database is still alive...
SQLHDBC m_hConn;
...
SQLINTEGER siDead = SQL_CD_FALSE;
::SQLGetConnectAttr(m_hConn
,SQL_ATTR_CONNECTION_DEAD
,&siDead //SQL_CD_TRUE or SQL_CD_FALSE
,sizeof(siDead)
,NULL);
if (siDead == SQL_CD_TRUE)
{
//Database connection is dead
}

ODBC BCP Error Handling in C++

(Please let me know if there is a better group to post this on...)
I have written a C++ program that BCP's data into SQL Server using ODBC.
I'm currently at the point that I am testing worst-case scenarios. In the
scenario that while the BCP is running, I pull the network cable from SQL
server, I get failed calls to bcp_sendrow, but I am unable to get details on
the error. I have tried calling SQLGetDiagRec with handle types of
SQL_HANDLE_ENV, SQL_HANDLE_DBC, and SQL_HANDLE_STMT.
Any suggestions would be appreciated.
Thanks.
-ThomasI figured it out myself. In case anyone is interested, here is how to
determine whether the connection to the database is still alive...
SQLHDBC m_hConn;
..
SQLINTEGER siDead = SQL_CD_FALSE;
::SQLGetConnectAttr(m_hConn
,SQL_ATTR_CONNECTION_DEAD
,&siDead //SQL_CD_TRUE or SQL_CD_FALSE
,sizeof(siDead)
,NULL);
if (siDead == SQL_CD_TRUE)
{
//Database connection is dead
}