Odd program behavior
icc at po.cwru.edu
Tue Mar 28 20:46:27 EST 2000
Sorry for including the entire original message, just in case you forgot my
plea for help. I got it to work, here's how I did it, and why I'm a lamer.
I downloaded freetds 0.50 again, untarred it and such, went into the
src/tds/ directory, edited token.c, went into the tds_process_msg(...)
function, and un-commented the following line, which is sorta at the end of
fprintf(stderr, "Msg %d, Level %d, State %d, Server %s, Line %d\n%s\n",
At which point I compiled freetds, compiled my test program, and learned
very quickly that I (and here's where I'm a lamer) had inadvertantly
switched tds_set_user(...) and tds_set_passwd(...) in my test program, which
when properly fixed allowed me to connect to our production server.
I just wanted to say thank you for your help and paitence as I try to be
more intelligent, and if anyone's getting odd responses from their SQL
server, they might want to try uncommenting that line as I did. Actually,
it'd be cool if tds_process_msg(...) checked to see if an environment
variable, say TDSLOGMSG was set or not set, and if it was set, and TDSDUMP
was also set, then tds_process_msg(...) would add all messages to the
TDSDUMP file in the same format as that line I uncommented. Just a
Thanks again Brian and Bob. I'll let the mailing list know when my apache
module (mod_auth_tds) is done.
----- Original Message -----
From: "Brian Bruns" <camber at umcc.ais.org>
To: "TDS Development Group" <freetds at franklin.oit.unc.edu>
Sent: Wednesday, January 26, 2000 7:50 PM
Subject: [freetds] Re: Odd program behavior
> On Wed, 26 Jan 2000, Ian Charnas wrote:
> > Hello, I'm a college programmer writing some apache authentication
> > and I'm currently working on mod_auth_tds which will authenticate users
> > a Sybase or MS SQL database server. I'm currently planning on using
> > freetds as my C interface into the database servers.
> > I wish I could have figured this out myself, but I can't. I read the
> > over and over, I read all the archived messages from the mailing list,
> > I looked through all the pertinant source code, but I still can't figure
> > out how to fix this problem:
> > I compiled the code found at the bottom of the message, which is simply
> > test to see if the program can login correctly to the SQL server, and it
> > connects to myserver1 correctly. myserver1 is a development server
> > NT 4.0 server and SQL 7.0.
> > The problem is when I try to connect to the production server (myserver2
> > let's call it) running the same operating system and the same SQL Server
> > (same versions of course). That continually fails on login. I'm sure
> > username/password is correct, I'm fairly sure the interfaces file is
> > correct in syntax, and I configured FreeTDS --with-tdsver=4.2 as I
> > have.
> > The odd thing is I can however, connect to both myserver1 and myserver2
> > I write the code in perl and use DBD::Sybase and the DBI scheme, which
> > me know it's not a network problem, my username/password is correct, and
> > on.
> Interesting one, I was about to suggest it might be that you had only
> domain logins to the second server, but this blows that theory out of the
> water. Are you using the same service pack on both servers?
> > So, I set the TDSDUMP environment variable and the following is a
> > printout of the error according to the log file...(I neglected to
> > the printout of what packets were sent, because they contain my
> > username/password)
> > /****************************/
> > 2000-01-26 01:13:10 inside tds_process_login_tokens()
> > 2000-01-26 01:13:11 inside tds_process_default_tokens() marker is aa
> > 2000-01-26 01:13:11 inside tds_process_default_tokens() marker is fd
> > 2000-01-26 01:13:11 leaving tds_process_login_tokens() returning 0
> > /****************************/
> > Anyone have any idea as to what I can try to get this to work?
> This shows that you are getting a valid return from the SQL Server, but
> alas not a login acknowledgement.
> I tried your script and was able to connect against Sybase...have not been
> able to try MS SQL yet. (hopefully tommorow).
> So, here is what to do...see that marker is aa message up there? that's
> your error that the database is returning. you need to print the text of
> that out. Way number one, install a message handler...you can look in
> dblib or ctlib for specifics...(I should create a sample showing how to do
> this someday)...Way number two (the easy way) run this through the
> debugger, set a breakpoint in tds_process_msg() and print the relevent
> Hope this helps, and send me a link to your program when its done!
> You are currently subscribed to freetds as: icc at po.cwru.edu
> To unsubscribe, forward this message to
More information about the FreeTDS