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

Harry Sfougaris hsfougaris at gmail.com
Sat May 8 17:37:10 EDT 2010


On 09 Μαϊ 2010, at 12:25 π.μ., Paul Thurston wrote:

> 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?
> 
Yes
> 2.        Do you have permissions to create a socket?
> 
Not sure. How can I test this?

> 3.       Have you built a debug library and been able to step through the code to the point of failure in FreeTDS?
> 
Yes, that how I got to the line 
 rc = tds_ctx->err_handler(tds_ctx, tds, &msg);

> 4.       Does it fail trying to initialize WinSock? Put a breakpoint in net.c, around line 136.
> 
the line that fails is 	if (TDS_IS_SOCKET_INVALID(tds->s = socket(AF_INET, SOCK_STREAM, 0))) {

> 5.       What message to you get when you attempt to telnet on port 1433 to your SQL Server from the command line?
> 
Nothing, just a blank screen (the screen clears).

> 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?
> 
Well in order to get proper Greek text, I set the character set, and then convert each string I receive to unicode.
This was the only way to get Qt to work properly under Mac and Linux.
And also, why I'm struggling with FreeTDS; the ODBC drivers available for the Mac both use FreeTDS, but really mess up the encodings.
I have reported it to both of them, but they don't seem able or willing to fix it, so I thought I'd try working directly with FreeTDS which is so much faster anyway.

Before moving to FreeTDS, I was working with ODBC; everything worked fine in Windows, but I couldn't get proper data in the Mac version (I hadn't tried it under Linux).
Now, I have Mac and Linux working, but it seems a struggle with Windows (and I really need my app to work with Windows unfortunately).
And now I'm stuck with this issue which is a bit alarming and frustrating, but I'm sure we'll figure it out :)

Harry

> 
> 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
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds

Harry Sfougaris







More information about the FreeTDS mailing list