[unixODBC-dev] RE: FreeTDS Digest, Vol 22, Issue 19

Alf C Stockton alf at stockton.co.za
Mon Nov 15 16:01:11 GMT 2004

On Sat, 13 Nov 2004, Nick Gorham wrote:

> The error string is from the connection, the connect will have returned 
> SUCCESS_WITH_INFO, -2 is SQL_INVALID_HANDLE, check you have allocated the 
> statement handle correctly...
That is somewhat confusing as I got:-
About to SQLConnect()
Connected !
and I check for SQL_SUCCEEDED which includes SUCCESS_WITH_INFO and there was no 
error there.
The code looks like :-

         printf("About to SQLConnect()\n");
         V_OD_erg = SQLConnect(V_OD_hdbc,
                                  (SQLCHAR*) server, SQL_NTS,
                                  (SQLCHAR*) user, SQL_NTS,
                                  (SQLCHAR*) password, SQL_NTS);

         if (!SQL_SUCCEEDED(V_OD_erg))
         printf("Error SQLConnect %d %s %s %s\n",V_OD_erg, server, user, password);
         SqlError("SQLConnect",V_OD_Env, SQL_HANDLE_ENV);

         printf("Connected !\n");
              "SELECT * FROM jackpot_register WHERE message_id = 34",SQL_NTS);
         if (!SQL_SUCCEEDED(V_OD_erg))
                 printf("Error Select %d\n",V_OD_erg);
                 SqlError("SQLExecDirect",V_OD_Env, SQL_HANDLE_ENV);

and the error comes from the SQLExecDirect not the SQLConnect.


Alf Stockton	www.stockton.co.za

It's lucky you're going so slowly, because you're going in the wrong

More information about the unixODBC-dev mailing list