linux connectivity sqlcmd works but c code does not


  • This question has been asked before by others, "answered" and moved, but no real answer. I have Linux driver 11 set up and am trying to connect to a Windows machine with sql server from on fedora 19x64. If I use sqlcmd on Linux terminal with -S Server..., I connect, but no matter what I seem to do with an adapted C program that was provided by a MS person on a blog It fails at the

    // Connect to data source     
                retcode = SQLConnect(hdbc, (SQLCHAR*) "SQLCMD", SQL_NTS, (SQLCHAR*) "Test1", 5, (SQLCHAR*) "Password1", 9); 

    with changes to the arguments for me like

    // Connect to data source     
                retcode = SQLConnect(hdbc, (SQLCHAR*) "trogw", 5, (SQLCHAR*) "XX", 2, (SQLCHAR*) "XXXXXXXXXX", 10);      

    That -H fails to connect on sqlcmd but -S works makes me think something is amiss with the connection string in the c code, or the character width/encoding is not right....

    It would be nice to see someone's working connection code.   

    Friday, November 01, 2013 5:51 PM

All replies