[freetds] 0.83.dev.20100507 and Visual Studio 2010

Paul Thurston pthurston at netegrate.com
Sat May 8 17:25:30 EDT 2010


Harry:

The 32bit libraries that I posted for you are currently in production. This is a known good build.
This must be an issue in your environment (and in Windows 7, that usually means a security issue).

Some questions:


1.       Are you running with Administrator privileges on your Windows 7 box?

2.        Do you have permissions to create a socket?

3.       Have you built a debug library and been able to step through the code to the point of failure in FreeTDS?

4.       Does it fail trying to initialize WinSock? Put a breakpoint in net.c, around line 136.

5.       What message to you get when you attempt to telnet on port 1433 to your SQL Server from the command line?

Oh, just as a curiosity, why are you specifying a character set? My app runs just fine using the default (unspecified) one.
Finally, which version of SQLServer are you trying to hit?


Paul



From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Harry Sfougaris
Sent: Saturday, May 08, 2010 4:53 PM
To: FreeTDS Development Group
Subject: Re: [freetds] 0.83.dev.20100507 and Visual Studio 2010






On 08 Μαϊ 2010, at 9:05 μ.μ., Paul Thurston wrote:



> Harry:

>

> Are you using dblib and connecting to SQLServer?

Yes I am. (dblib to Sql Server 2008).



Now for the bad news: my Visual Studio C++ Console app is not working.

It was quietly dying before, which I only realized after adding some code to retrieve data.



There seem to be 2 issues: an unable to open socket error, and the error handlers not getting installed ( I think as they're not being called), so the program just crashes.

This is after calling dbopen(), and it is in tdserror(...) The actual message is "Unable to open socket" (by inspecting the variable msg) but the program crashes when trying to call rc = tds_ctx->err_handler(tds_ctx, tds, &msg);



Qt seems to link fine now, but also quietly dies - I guess it's for the same reason.

Maybe it's the socket libraries I'm linking?

I used WS2_32.lib , odbc32.lib, odbccp32.lib (and of course the other 3 libraries).



I tried both Win32 and x64 builds - same results. And of course I do have connectivity to my server.



My freetds.log mentions the following:

23:46:10.023 3268 (log.c:190):Starting log file for FreeTDS 0.65

      on 2010-05-08 23:46:10 with debug flags 0xffff.

23:46:10.023 3268 (iconv.c:78):Using trivial iconv

23:46:10.023 3268 (iconv.c:197):names for ISO-8859-1: ISO-8859-1

23:46:10.023 3268 (iconv.c:197):names for UTF-8: UTF-8

23:46:10.023 3268 (iconv.c:197):names for UCS-2LE: UCS-2LE

23:46:10.023 3268 (iconv.c:197):names for UCS-2BE: (null)

23:46:10.023 3268 (iconv.c:363):iconv to convert client-side data to the "CP1253" character set

23:46:10.023 3268 (iconv.c:477):tds_iconv_info_init: use memcpy to convert "CP1253"->"UCS-2LE"

23:46:10.038 3268 (net.c:210):Connecting to 10.1.1.11 port 1433 (TDS version 8.0)

23:46:14.176 3268 (util.c:334):tdserror(00271C30, 00277A10, 20008, 0)

23:46:14.176 3268 (dblib.c:7782):dbperror(00277118, 20008, 0)

23:46:14.176 3268 (dblib.c:7835):20008: "Unable to open socket"

23:46:14.176 3268 (dblib.c:4781):default_err_handler 00277118, 9, 20008, 0, 0123DD40, 00277FE023:46:14.176 3268 (dblib.c:4747):dbdead(00277118) [dead]

23:46:14.176 3268 (dblib.c:7856):"Unable to open socket", client returns 0 (INT_EXIT)

23:46:14.176 3268 (dblib.c:7903):FreeTDS: db-lib: exiting because client error handler returned 0 for msgno 20008



(the FreeTDS 0.65 strikes me as very odd, as I am working with 0.82)



My program is dead simple:

int main(int argc, char **argv)

{

    LOGINREC *login;

    RETCODE erc;

      DBPROCESS *dbproc;

      dberrhandle(syb_err_handler);

    dbmsghandle(syb_msg_handler);



    if (dbinit() == FAIL) {

            return -1;

    }



    if ((login = dblogin()) == NULL) {

            return =2;

    }



    dbsetifile((char*)"C:\\Users\\harry.MISSIRIAN\\freetds.conf");



    DBSETLUSER(login, "***" );

    DBSETLPWD(login,  "***" );

    DBSETLCHARSET(login, "CP1253" );

    if ((dbproc = dbopen(login, "sql" )) == NULL) {

            return -3;

    }





and my freetds.conf is like this:

[sql]

      host = 10.1.1.11

      port = 1433

      tds version = 8.0

      dump file = C:\Users\harry.MISSIRIAN\freetds.log

      debug flags = 0xffff



Harry



_______________________________________________

FreeTDS mailing list

FreeTDS at lists.ibiblio.org<mailto:FreeTDS at lists.ibiblio.org>

http://lists.ibiblio.org/mailman/listinfo/freetds


More information about the FreeTDS mailing list